PDA

View Full Version : SortTypes.asDate



sean
26 Mar 2007, 2:08 PM
hello,

i was noticing some strange behavior around sorting columns in a grid that contained date instances. the behavior would come up when some of the columns contained null values. took a quick look at the SortTypes.asDate function and it appears that nulls aren't accounted for.


asDate : function(s) {
if(s instanceof Date){
return s.getTime();
}
return Date.parse(String(s));
},

perhaps returning 0 if (!s) would resolve this. i also noticed that the int and float sorts are using parseInt and parseFloat js functions. what if these values are already number types? seems like the conversion to string and then back could be avoided? please let me know if i'm missing something. still new to all this.

thanks,
sean