1. #1
    Sencha User edykstra's Avatar
    Join Date
    Feb 2009
    Posts
    98
    Vote Rating
    2
    edykstra is on a distinguished road

      0  

    Default Which date field has the 'greater' date?

    Which date field has the 'greater' date?


    I have a form with 2 date fields.

    Inside the select event of each, I want to check to see if it is 'greater' (after) than the other. How do I do that?

    It should be EASY - but this is a classic example of the ExtJS docs reminding me of the Seinfeld episode 'A lot about nothing'.

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,148
    Vote Rating
    673
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      -1  

    Default


    Not sure what this has to do with the Ext docs.

    Should we include a section "How to check if one date is greater than another date".

    Anyway, it is easy and it's done in JS:

    Code:
    // May also want to deal with nulls
    var d1 = field1.getValue().getTime(),
        d2 = field2.getValue().getTime();
    
    console.log(d1 > d2);
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

Thread Participants: 1

Tags for this Thread