We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Swift Version
Swift version 4.0 (swift-4.0-RELEASE) Target: x86_64-unknown-linux-gnu
Linux Version
Distributor ID: Ubuntu Description: Ubuntu 16.04.3 LTS Release: 16.04 Codename: xenial
md5: e21aefe09a7e60f420e5013977160531
Issue Description:
When attempting to determine the difference between two dates using, I am experiencing the following fatal error:
fatal error: file Foundation/NSCalendar.swift, line 613
The following line of code causes the crash:
var difference = Calendar.current.dateComponents([.month, .year, .day], from: date1, to: date2)
The text was updated successfully, but these errors were encountered:
#1658
Sorry, something went wrong.
This is fixed in the master branch:
$ cat sr_7011.swift import Foundation let date1 = Date(timeIntervalSince1970: 0) let date2 = Date() var difference = Calendar.current.dateComponents([.month, .year, .day], from: date1, to: date2) print("Difference between", date1, "and", date2, ":") print("Year:", difference.year!, "Month:", difference.month!, "Day:", difference.day!) $ ~/swift-DEVELOPMENT-SNAPSHOT-2018-08-15-a-ubuntu16.04/usr/bin/swift sr_7011.swift Difference between 1970-01-01 00:00:00 +0000 and 2018-08-16 19:32:41 +0000 : Year: 48 Month: 7 Day: 15
spevans
No branches or pull requests
Environment
Swift Version
Linux Version
Additional Detail from JIRA
md5: e21aefe09a7e60f420e5013977160531
Issue Description:
When attempting to determine the difference between two dates using, I am experiencing the following fatal error:
The following line of code causes the crash:
The text was updated successfully, but these errors were encountered: