Closed icecrao2 closed 10 hours ago
Summary: timeZoneName
returns numeric offsets (e.g., "+07") instead of IANA timezone names (e.g., "Asia/Ho_Chi_Minh") on iOS, causing unexpected behavior in applications. Needs investigation into timezone data loading.
The timeZoneName
getter asks the operating system for the name, and returns that string verbatim.
There is no post-processing other that returning an empty string if the OS call failed.
The code is here, and it uses localtime_r to get the name.
If you get "+07"
, then it's because your operating system's localtime
implementation returns that string.
Hello Dart Team,
I have encountered an unexpected behavior in the DateTime class's timeZoneName property and would like to report it.
Problem Description The timeZoneName property of the DateTime class returns values in the format +07 instead of a proper timezone name (e.g., Asia/Ho_Chi_Minh or ICT) for certain countries like Vietnam. This behavior is unexpected and can lead to issues in applications that rely on accurate timezone names.
Steps to Reproduce Here is a simple code snippet to reproduce the issue:
Environment Information Dart Version : 3.5.3 Operating System: iOS
Expected Behavior The timeZoneName property should return a standard timezone name such as "Asia/Ho_Chi_Minh" or "ICT" instead of a numeric offset like "+07".
Additional Notes This issue might be related to the loading of timezone data in certain environments. Clarification on the intended behavior of the timeZoneName property in such cases would be highly appreciated.
Thank you for looking into this matter. I look forward to your feedback and resolution!
Best regards,