Closed luizfbicalho closed 7 years ago
This issue seems duplicate to #44
I think that his problem is when he type the date in the input with datepicker.
my problem is when it's displaying the date.
the problem is in the datetime.ts line 119 let date = moment(dateStr, dateFormat).toDate();
the component shouldn't use the dateformat to read any date that looks like "2010-01-01T00:00:00"
The problem is that you use date-format DD/MM/YYYY
and the value is a 'GMT format'
If you use date-format
, the value must follow the date-format you give.
If not, use Date object. e.g. var myDate = new Date("2010-01-01T00:00:00")
but the value return from a webapi formatted that way
Sorry, but this module should not care about different web api returns.
If you want to format in that way, you should provide the exact format or a date object as an input.
I know the server RESTful api returns date as a string with an ISO format, but not all of them doe s that. That's why I recommend you to build a date object from the given string, and use it for this. This module cannot follow all valid date format of all web api server returns.
This modules accepts only two possible value as an input for simplicity;
I made this plunkr https://plnkr.co/edit/yOoXEdAeVqUvlElVN32Q?p=preview if I put a Date object, it shoudn't return the date object back?
the displayed value should be the formatted and the internal value should be the date correct?
I set the date to 01/01/2010, using the DD/MM/YYYY format and I got another value in my datepicker
https://plnkr.co/edit/onkXaUSVycm9Ds3iOsoo?p=preview