[TIMOB-15413] iOS: Logging date to console shifts time by several hours
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2013-11-11T17:35:27.000+0000 |
Affected Version/s | Release 3.1.3 |
Fix Version/s | 2013 Sprint 24, 2013 Sprint 24 API |
Components | iOS |
Labels | ipass1 |
Reporter | Matej |
Assignee | Pedro Enrique |
Created | 2013-10-01T04:45:08.000+0000 |
Updated | 2017-03-28T20:20:36.000+0000 |
Description
Ti.API.log(new Date(1380589200000));
Ti.API.log(new Date(1380589200000).getHours());
*OUTPUT:*
2013-10-01 01:00:00 +0000 // WRONG
3 // RIGHT
The right date is: 2013-10-01 03:00:00 +0000, you can test it in browser's console or http://www.ruddwire.com/handy-code/date-to-millisecond-calculators
// I have no idea how it is possible ,but now it shows two hours instead three.
Please can somebody have a look on this issue? Thanks
Note: If I run log that contains some string + Date it return different format of date ,but it is right!
*OUTPUT:* [INFO] : 2013-10-01 01:00:00 +0000 [INFO] : -> Tue Oct 01 2013 02:00:00 GMT+0100 (BST)
Hi Matej, The result of both logs are identical, the difference is that the first log outputs it in the NSDate string format and the second in the .toString() format of the JS Date object. If you log the JS Date object a native NSDate object is created and the string representation gets logged: "2013-10-01 01:00:00 +0000" If you add a string to the date ("->" + new Date()) it will output the "toString()" version of the JS date. This is because the JS Engine converts it to a string at runtime and the native code reads it as a string, not a date.
Resolving issue as invalid
Closing