Results 1 to 2 of 2

Thread: Which date field has the 'greater' date?

  1. #1
    Sencha User edykstra's Avatar
    Join Date
    Feb 2009
    Posts
    98
    Vote Rating
    2
      0  

    Default 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 User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    18,970
    Vote Rating
    931
      -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);
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •