You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@royale.apache.org by GitBox <gi...@apache.org> on 2017/11/01 09:06:09 UTC

[GitHub] justinmclean opened a new issue #64: Invalid string comparison in new date code

justinmclean opened a new issue #64: Invalid string comparison in new date code
URL: https://github.com/apache/royale-asjs/issues/64
 
 
   This code is incorrect and fails to work:
   
   ```
           public function getIndexForSelectedDate():Number
           {
               if (!_selectedDate) return -1;
   
               var str:String = _selectedDate.toDateString();
   
               for(var i:int=0; i < _days.length; i++) {
                   var test:Date = _days[i] as Date;
   				
   				if (test && test.toDateString() == str)
   					return i;
   
               }
               return -1;
   		}
   ```
   
   As it is doing comparisons on dates stings like so:
   
   str: "Thu Nov 09 2017"
   test: "Thu Nov 09 2017 00:00:00 GMT+1100 (AEDT)"
   
   The strings will never match.
   
   (Tested on OSX Chrome other browsers may have the same issue)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services