1 Reply Latest reply on Jan 31, 2011 1:16 PM by mikem333

    dateCompare method in mx.utils.ObjectUtil

    betheflexcoder Level 2

      While working to compare two dates

      using the ObjectUtil.dateCOmpare method, I found that it

      works in a way contrary to my understanding about it.


      According to Flex documentation,

      If ObjectUtil.dateCompare(a,b), then


      this method should return

      0 if a and b are null or equal; 1 if a is null or before b; -1 if b is null or before a.


      In this case, i understand that a is before b means a is the date which is prior to b. But while testing this, I found that a is before b means a is the date which is after b.


      For ex:-

      This method returned '1' when ,


      var a:Date = new Date('06/15/2010')

      var b:Date = new Date('04/04/2010')


      ObjectUtil.dateCompare(a, b);


      From my understanding , it should return '-1', as b is the date which is prior to/before a


      Please reply back, if someone can clarify about this.