EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: crosemffet on November 26, 2012, 11:56:43 AM



Title: compare 2 dates with hh:mm:ss
Post by: crosemffet on November 26, 2012, 11:56:43 AM
I'm using: datetime box, format: yyyy-mm-dd hh:mm
the idea is compare 2 dates for report, starting date and ending date. obviously, ending date should be > than starting date.
I'm using the following parser function:
 parser:function(s){
    if (!s) return new Date();
    var ss = s.split('-');
    var y = parseInt(ss[0],10);
    var m = parseInt(ss[1],10);
    var d = parseInt(ss[2],10);
    if (!isNaN(y) && !isNaN(m) && !isNaN(d)){
       return new Date(y,m-1,d);
    } else {
       return new Date();
    }
 }
it works perfect, except that it's not comparing the hh:mm part. only compares yyyy-mm-dd.
any modification will be very useful, I've been stucked in this point for hours...