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-8334] Something so strange when get date component from a date before 19XX #3661

Open
swift-ci opened this issue Jul 20, 2018 · 0 comments

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-8334
Radar None
Original Reporter rafaelbcdr (JIRA User)
Type Bug
Environment

My environment:
Xcode Version 10.0 beta 3 (10L201y)
Swift version 4.0

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

md5: 7b4a04ce19b94c22929957bd1dccb5b4

Issue Description:

I'm printing the minute from a date like "1901-01-01 00:00:00 +0000" and getting value equals "53".

the code executed from Playgrounds:

extension Date {

static var fullFormat = "yyyy-MM-dd H:mm:ss ZZZZ"

static func fromString(_ dateString: String, dateFormat: String)-> Date

{ let dateFormatter = DateFormatter() dateFormatter.dateFormat = dateFormat let date = dateFormatter.date(from: dateString) return date! }

var minute: Int

{ var components = Calendar.current.dateComponents([.minute], from: self) return components.minute! }

}

let d = Date.fromString("1901-01-01 00:00:00 +0000", dateFormat: Date.fullFormat)
print(d.minute)

@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

1 participant