openpsa / jsgrid

Fork of last jqGrid version before license change
http://openpsa.github.io/jsgrid/
Other
28 stars 12 forks source link

Date filtering issue #22

Closed meh-uk closed 9 years ago

meh-uk commented 9 years ago

Taken from jqGrid #674 newformat is applied in parsedate() even when the date has already been converted. This breaks the filtering of dates when newformat differs from srcformat.

To recreate: Input is 2014-09-08; datatype = local; // I assume this is a/the culprit srcformat = 'Y-m-d'; newformat = 'n/j/Y'; Enable filter toolbar.

The grid shows 9/8/2014, but won't filter correctly because when filtering jqGrid is trying to apply 'Y-m-d' to 9/8/2014.)

OlegKi commented 9 years ago

@meh-uk : I'm not sure that it's a bug. Try the demo. It uses different srcformat and newformat and it works.

I know many bug reports in working with dates. The problem is wrong usage of date options. I wanted to extend default templates (see here) with two-three or more additional templates for date. So that one can just include template: "dateIso", template: "dateTimeIso", template: "dateIsoDatepicker" and so on. The default newformat will be used from the locale file. To implement template: "dateIsoDatepicker" one need to extend newformat with jsNewFormat which use more common use JavaScript/jQuery UI format of date (see here) instead of PHP date format (see here). One can look through all existing locale files and to fill the field jsNewFormatbased onnewformat`. I'm sure that there are not so much variants.

I think that one should provide the usage of new globalize plugin which will use Unicode CLDR JSON data after the plugin will be final.

meh-uk commented 9 years ago

I've reproduced this in a demo.

meh-uk commented 9 years ago

Fix merged. Now closing.