ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: TeeJT on February 28, 2017, 01:07:18 pm

Title: Null date not displayed correctly
Post by: TeeJT on February 28, 2017, 01:07:18 pm
I am using ParamQuery Pro v3.3.4
The null date for this "format": "dd-M-yy" in the column model appears as: NaN-undefined-NaN
I noticed that your sample displays the null date as blank - https://paramquery.com/pro/demos/filter_header_local

By the way, I included mement.js - does this affect ParamQuery?
Title: Re: Null date not displayed correctly
Post by: paramvir on February 28, 2017, 03:16:45 pm
paramquery uses jqueryui formatDate method to format dates.

$.datepicker.formatDate('dd-M-yy', null) returns "", I'm not sure what's wrong in your case. It would be easier to find out if you could please share a jsfiddle.

BTW have you added dataType: 'date' to the column?
Title: Re: Null date not displayed correctly
Post by: TeeJT on March 01, 2017, 09:56:14 am
I have found out the problem. In my company we are using stdlib.js from http://stdlibjs.com/
This caused the problem.
When the format is dd-M-yy for a null date - the display is NaN-undefined-NaN
When I remove this script - it is OK.
Can I do a prototype to overcome this problem?
We need to use stdlib.js in our projects.
The version we use is - http://teejt.drivehq.com/testing/Visual/ParamQuery/stdlib.js
I tried to attach it but it was not allowed
Title: Re: Null date not displayed correctly
Post by: paramvir on March 02, 2017, 09:44:33 am
stdlib turns out to be incompatible with ParamQuery.

As I checked, stdlib modifies Date.parse() so that Date.parse(undefined) returns current date ( which is non-standard ) whereas it returns NaN in the browsers.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse
Title: Re: Null date not displayed correctly
Post by: TeeJT on March 02, 2017, 12:10:23 pm
Thanks! I have also found that the Date.parse was giving the problem and have commented it out. Yes indeed for undefined it returns current date and time.