Permalink
Browse files

Merge pull request #281 from OlegKi/master

Support local data having type Date
  • Loading branch information...
2 parents d92d6da + 0ba9efd commit af9a7da033856a5cd9906574885e778b5c7442fb @tonytomov committed Mar 26, 2012
Showing with 6 additions and 0 deletions.
  1. +6 −0 js/grid.base.js
View
@@ -300,6 +300,7 @@ $.extend($.jgrid,{
return(self._compare(a,b,1)===0);
};
this._compare=function(a,b,d){
+ var toString = Object.prototype.toString;
if( d === undefined) { d = 1; }
if(a===undefined) { a = null; }
if(b===undefined) { b = null; }
@@ -312,6 +313,11 @@ $.extend($.jgrid,{
if(a!==null&&b===null){
return -1;
}
+ if (toString.call(a) === '[object Date]' && toString.call(b) === '[object Date]') {
+ if (a < b) { return -d; }
+ if (a > b) { return d; }
+ return 0;
+ }
if(!_usecase && typeof(a) !== "number" && typeof(b) !== "number" ) {
a=String(a).toLowerCase();
b=String(b).toLowerCase();

0 comments on commit af9a7da

Please sign in to comment.