[AC-5631] Android: Timezone is ignored
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Resolved |
Resolution | Hold |
Resolution Date | 2018-06-19T11:14:52.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | 7.0.2.GA, ANDROID |
Reporter | Andreas Pingas |
Assignee | Shak Hossain |
Created | 2018-02-28T10:05:03.000+0000 |
Updated | 2018-06-19T11:14:53.000+0000 |
Description
In certain devices appears the bug i will describe below.
For example, when i run the following
Ti.API.info('2017-08-14T20:30:00.0Z');
Ti.API.info(new Date('2017-08-14T20:30:00.0Z'));
Ti.API.info(new Date('2017-08-14T20:30:00.0Z').getTimezoneOffset());
Ti.API.info(String.formatTime(new Date('2017-08-14T20:30:00.0Z'), 'long'));
and i get the following result:
[INFO] : 2017-08-14T20:30:00.0Z
[INFO] : Mon Aug 14 2017 23:30:00 GMT+0300 (EEST)
[INFO] : -180
[INFO] : 12:30
The result is always the same, and doesn't take into account what timezone has the user set on his device.
Only on String.formatTime its taken into account.
Thank you
Hello, What are the devices that have the issue? Please share the details. Thanks.
The following devices: Xiaomi mi5 Xiaomi Redmi 4x
Hello [~andreas.pingas], We don't think it's a bug. Talking about string output differences between Android and iOS, neither are technically wrong, they're just presenting the dates in different ways. In both cases, the given date objects are stored interpreted as universal time. The difference is that Android is outputting the UTC date in local time +/- timezone and iOS is outputting the UTC date as-is (same string given to the Date object) but doesn't output the timezone. Personally, I think Google V8 is handling this better because it clarifies the timezone and Apple's JavaScriptCore is not. But in any case, this is why you should always use String.formatTime(). This is used to output the Date object to your liking. Notice that String.formatTime() outputs the Date object pretty much the same between Android and iOS. Hope this helps. Let us know. Thanks.