-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(win32/zone_names): add missing GMT on windows #16277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
This is an auto generated file. Please check the script and data source. |
|
$ Get-TimeZone -Id "GMT"
Id : GMT
HasIanaId : True
DisplayName : (UTC) Co-ordinated Universal Time
StandardName : Co-ordinated Universal Time
DaylightName : Co-ordinated Universal Time
BaseUtcOffset : 00:00:00
SupportsDaylightSavingTime : FalseMaybe we should add such a custom alias in |
|
@straight-shoota You might also have aliases for GMT-14 - GMT+12 (to UTC+14 - UTC-12). I don't even have |
|
Searching a bit, I found a stackoverflow question that led me to the C# TimezoneConverter library that injects the GMT alias to UTC. |
|
The built-in PowerShell 5.x does not use ICU, only the newer 7.x does, which needs to be manually installed. In that case @[Link("icu")]
lib LibICU
alias Char = UInt16
enum ErrorCode
U_ZERO_ERROR = 0
end
fun ucal_getWindowsTimeZoneID(id : Char*, len : Int32, winid : Char*, winidCapacity : Int32, status : ErrorCode*) : Int32
end
status = LibICU::ErrorCode::U_ZERO_ERROR
id = "GMT"
winid = uninitialized UInt16[100]
len = LibICU.ucal_getWindowsTimeZoneID(id.to_utf16, -1, winid, winid.size, pointerof(status))
if len != 0
p String.from_utf16(winid.to_slice[0, len]) # => "UTC"
endJudging from the ICU specs, the |
|
Should we close this and change this pull to an issue? as I am unsure how to solve... |
|
You could simply do
|
|
Yeah I am using There are datetime strings out there with GMT in them that most people will expect crystal to be able to parse no matter which platform they're on |
|
Chopping GMT sounds like a good workaround. But I think it makes sense to support GMT as a valid time zone identifier on Windows. Historically, it has been used as a generic name in a similar manner as UTC. |
Support GMT as a valid time zone identifier, even without a zoneinfo database. Historically, it has been used as a generic name in a similar manner as UTC. As the use case in #16277 shows, GMT is relevant for data exchange.
on windows:
puts ::Time::Location.load("GMT")will raise:Issue I am having: https://github.com/spider-gazelle/openssl_ext/actions/runs/18819046827/job/53691685453#step:5:144