Adobe-Runtime-Support icon indicating copy to clipboard operation
Adobe-Runtime-Support copied to clipboard

TimeZone.getTimeZone(null) returns null

Open XG-Taiwan opened this issue 2 years ago • 6 comments
trafficstars

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

XG-Taiwan avatar Apr 18 '23 20:04 XG-Taiwan

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.

itlancer avatar Feb 27 '24 15:02 itlancer

This is one of those "works for us" things....

For that scenario to return a null timezone on Windows, then either:

  1. The kernel32.dll library does not contain a function called GetDynamicTimeZoneInformation
  2. 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 avatar Feb 28 '24 08:02 ajwfrost

@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"

itlancer avatar Mar 02 '24 14:03 itlancer

@ajwfrost Issue still exists using AIR 50.2.4.5 for Windows.

itlancer avatar Apr 02 '24 09:04 itlancer

@ajwfrost Issue still exists with AIR 51.0.1.4 for Windows.

itlancer avatar Jul 09 '24 14:07 itlancer