Adobe-Runtime-Support
Adobe-Runtime-Support copied to clipboard
TimeZone.getTimeZone(null) returns null
Problem Description
A TimeZone.getTimeZone(null) call returns null instead of a TimeZone object representing the current location of the device, as it is stated within the ASDocs: "Pass in a null string to get the TimeZone object representing the current location of the device."
- AIR SDK: 50.2.2.4
- Flex SDK: 4.16
- Affected environment: Win 11 (didn't test it on other Platforms / Devices yet)
Steps to Reproduce
Example:
var timeZone:TimeZone = TimeZone.getTimeZone(null);
trace(timeZone); // null
Issue still exists with AIR 51.0.0.2 for Windows. May be some locale-specific comparison under the hood... There is no such issue for Android.
This is one of those "works for us" things....
For that scenario to return a null timezone on Windows, then either:
- The kernel32.dll library does not contain a function called
GetDynamicTimeZoneInformation - Or, that function call (passing the address of a blank DYNAMIC_TIME_ZONE_INFORMATION structure) is returning false.
Ah .. so, re-reading the documentation for it, maybe the function would return false if you are in a locale that does not support 'dynamic' time zones i.e. daylight saving. So actually, if that function fails, we can instead call GetTimeZoneInformation and populate things appropriately...
thanks
@ajwfrost
Issue still exists with AIR 51.0.0.3 for Windows.
For example try with time zone (execute via CMD):
tzutil /s "Turkey Standard Time"
@ajwfrost Issue still exists using AIR 50.2.4.5 for Windows.
@ajwfrost Issue still exists with AIR 51.0.1.4 for Windows.