EasyUI Forum
September 14, 2025, 04:46:09 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: compare 2 dates with hh:mm:ss  (Read 8060 times)
crosemffet
Jr. Member
**
Posts: 68



View Profile WWW Email
« 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...
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!