Skip to content
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

[SR-15114] Calendar.startOfDay wrong for Irish Standard Time #3950

Open
swift-ci opened this issue Aug 25, 2021 · 2 comments
Open

[SR-15114] Calendar.startOfDay wrong for Irish Standard Time #3950

swift-ci opened this issue Aug 25, 2021 · 2 comments

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-15114
Radar rdar://problem/82345634
Original Reporter kencarroll (JIRA User)
Type Bug
Environment

Linux, Ubuntu 18.04

Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Bug
Assignee None
Priority Medium

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.

@typesanitizer
Copy link

@swift-ci create

cc @millenomi

@millenomi
Copy link
Contributor

What's the `env` you're running the process as? kencarroll (JIRA User)

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants