Link to home
Start Free TrialLog in
Avatar of wdarnellg
wdarnellgFlag for United States of America

asked on

App Has Period?

I have never seen anything like this. When I add a child record to my main form, the Birthdate field loads with a period in the input box. I have no idea how this is happening. Has anyone in this community seen anything like this? What could be causing it? I promise this is NOT a spoof or joke.

HTML
<input name="Birthdate" class="form-control input-sm" data-bind="attr:{'id': 'Birthdate_' + $index()}, value: Birthdate, date: Birthdate, format: 'MM DD YYYY', event: {change: flagIndividualsAsEdited}" placeholder="Birthdate"/>
                        </td>

Open in new window


JS function adding child viewModel and defaults.
        self.addFamilyMember = function() {
            var individuals = new IndividualsViewModel({ Id: -1, FirstName: "", MiddleName: "", LastName: "", Gender: "", PhoneNumber: "0000000000", Email: "", Birthdate: "", AdultBirthdateDecline: 0, Ethnicity: "", USTANumber: "", FamilyRole: "", RelationshipType: "", ObjectState: ObjectState.Added });
            self.Individuals.push(individuals);
        },

Open in new window


THE DEMON PERIOD!
User generated image
ASKER CERTIFIED SOLUTION
Avatar of Steve Bink
Steve Bink
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of wdarnellg

ASKER

That was it. It was this part code that formats the date:
       var value = valueAccessor();
            var pattern = allBindings.format || "MM/DD/YYYY";
            var valueUnwrapped = ko.utils.unwrapObservable(value);

            var output = "-";
            if (valueUnwrapped !== null && valueUnwrapped !== undefined && valueUnwrapped.length > 0) {
                output = moment(valueUnwrapped).format(pattern);
            }
            if ($(element).is("input") === true) {

                $(element).val(output);
            } else {
                $(element).text(output);
            }

Open in new window


Thanks for the insight!