Click here to Skip to main content
15,889,877 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Data field is StartDate. Data is retrieved from server via ajax call in Json format. StartDate comes as JSON date /Date(1453356000000)/.

A textbox id bind using ng-bind as below.

HTML
<input type="text" ng-model="di.StartDate | JSONdate | date: 'dd-MMM-yyyy'" required placeholder="dd-MMM-yyyy" data-dateformat="dd-M-yy" datepicker />


Date is displayed as "21-Jan-2016" expected.

Now when I click the textbox to change the date, datepicker popups. I select a new date.

Now the problem is in the JSON object (di) an new attribute/property is created along with the original "StartDate" attribute/property.

JavaScript
StartDate : '/Date(1453356000000)/'
StartDate | JSONdate | date: 'dd-MMM-yyyy' : '12-Jan-2016'


Please help.
Posted

1 solution

Problem might be because of two different date format used. Try getting the data in similar format. Either process the data in javascript before assigning it to model or try setting the calendar date format similar to date format you fetch from server. If you can this on plunker i can help you in better way.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900