You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When formatting a date with the EST time zone on macOS and the Static Linux SDK, the resulting date string is inconsistent between the two platforms.
macOS
Resolved Time Zone for EST is EST
It is now Thursday, October 10, 2024 at 3:32:23 PM GMT-05:00
Linux
Resolved Time Zone for EST is EST
It is now Thursday, October 10, 2024 at 4:32:23 PM Eastern Daylight Time
Swift: Apple Swift version 6.0.1 (swift-6.0.1-RELEASE) Target: arm64-apple-macosx15.0 Static Linux SDK: swift-6.0.1-RELEASE_static-linux-0.0.1 macOS: 15.0.1 Linux: Alma Linux 8.10
FoundationTest.swift
import Foundation
@mainstructApp{staticfunc main()asyncthrows{letdate=Date()letidentifier="EST"lettimeZone=TimeZone(identifier: identifier)print("Resolved Time Zone for \(identifier) is "+(timeZone?.identifier ??"Invalid"))letformatter=DateFormatter()
formatter.locale =Locale(identifier:"en_US_POSIX")
formatter.timeZone = timeZone
formatter.dateStyle =.full
formatter.timeStyle =.full
letformatted= formatter.string(from: date)print("It is now \(formatted)")}}
xcrun --toolchain swift swift build --swift-sdk x86_64-swift-linux-musl
Build for macOS
xcrun --toolchain swift swift build
The text was updated successfully, but these errors were encountered:
barnard-b
changed the title
Inconsistent Time Zone Formatting Between macOS and Linux Static SDK
Inconsistent Time Zone Formatting Between macOS and Static Linux SDK
Oct 10, 2024
A bug in Linux, where you've set the timezone to be EST, but the output is in EDT.
Inconsistent behavior of the time zone representation: Linux is using the timezone identifier, but mac is using GMT offset. I think the full name is the expected behavior.
I do want to point out that this isn't 100% correct...
"EST" isn't a valid time zone identifier. It's an abbreviation, so you should be using the other API, which reverse-look up the appropriate identifier for you
lettimeZone=TimeZone(abbreviation:"EST")
Using this would solve (2) and format EST as its full name.
When formatting a date with the EST time zone on macOS and the Static Linux SDK, the resulting date string is inconsistent between the two platforms.
macOS
Linux
Swift: Apple Swift version 6.0.1 (swift-6.0.1-RELEASE) Target: arm64-apple-macosx15.0
Static Linux SDK: swift-6.0.1-RELEASE_static-linux-0.0.1
macOS: 15.0.1
Linux: Alma Linux 8.10
FoundationTest.swift
Package.swift
Build for Linux
Build for macOS
The text was updated successfully, but these errors were encountered: