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 obtaining a value for midnight using Calendar.startOfDay(for: Date) with a Time Zone set to Europe/Dublin, the value returned is for Asia/Kolkata.
It appears the issue stems from the fact that both time zones have the same abbreviation (IST).
The following code illustrates the issue:
======= BEGIN CODE
import Foundation
let now = Date()
print("Now: (now)")
var cal = Calendar.current
Environment
Linux, Ubuntu 18.04
Additional Detail from JIRA
md5: ebf1616a91fe2536cab5db2906880123
Issue Description:
When obtaining a value for midnight using Calendar.startOfDay(for: Date) with a Time Zone set to Europe/Dublin, the value returned is for Asia/Kolkata.
It appears the issue stems from the fact that both time zones have the same abbreviation (IST).
The following code illustrates the issue:
======= BEGIN CODE
import Foundation
let now = Date()
print("Now: (now)")
var cal = Calendar.current
print("CAL: (cal), Locale: (cal.locale?.identifier), TZ: (cal.timeZone)")
let midnight = cal.startOfDay(for: now)
print("MID: (midnight)")
====== END CODE =======
To verify, set the time zone to Kolkata (timedatectl set-timezone Asia/Kolkata).
Execute the application.
Now set the timezone to Europe/London.
Execute the application.
Now set the timezone to Europe/Dublin.
Execute the application.
You will see that Europe/Dublin gives the same output as Asia/Kolkata.
timedatectl <ENTER> will verify that the timezone is set to Europe/Dublin, so the error must lie with the swift Calendar implementation.
The text was updated successfully, but these errors were encountered: