igniteui-angular icon indicating copy to clipboard operation
igniteui-angular copied to clipboard

Parse 'moment' and raw ISO string dates in datepicker

Open jdk339 opened this issue 8 years ago • 6 comments

Feature Request

It would be great if the igx-date-picker component could read both ISO date strings and 'moment' objects. Currently, I have to do something like the following:

this.payPeriods = payPeriods.map((pp: any) => {
    pp.startDate = pp.startDate ? new Date(pp.startDate) : null;
    return pp;
});

Also, the problem with this is that new Date() does not always parse strings properly, so if igx-date-picker could parse ISO strings it would help out a lot.

jdk339 avatar Nov 08 '18 20:11 jdk339

We're currently working on implementing an input in the date picker so the user could manually enter dates. This is the spec: https://github.com/IgniteUI/igniteui-angular/wiki/igx-datePicker-Specification

Related issue is #3034.

We will support various ISO date formats. For more details see the spec above.

bkulov avatar Dec 19 '18 08:12 bkulov

@jdk339 We don't have immediate plans to support moment library.

bkulov avatar Dec 19 '18 09:12 bkulov

@bkulov Okay thanks, at least ISO strings will be supported.

jdk339 avatar Dec 19 '18 14:12 jdk339

@jdk339 Could you please provide us a few examples of strings which could not be properly parsed by new Date() so we could test if igx-date-picker is parsing them correctly?

bkulov avatar Dec 20 '18 07:12 bkulov

@bkulov 2019-03-28T00:00:00 and any numerical variation of that format

jdk339 avatar Dec 20 '18 15:12 jdk339

Hello jdk339, igx-date-picker parses correctly new Date('2019-03-28T00:00:00') and displays it. With the current release, it will be possible to edit such dates as well.

sboykova avatar Feb 27 '19 16:02 sboykova