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

toRelativeString fails on ios 8 / swift 1.2 #4

Closed
chrissancho opened this issue May 23, 2015 · 1 comment
Closed

toRelativeString fails on ios 8 / swift 1.2 #4

chrissancho opened this issue May 23, 2015 · 1 comment

Comments

@chrissancho
Copy link

toRelativeString returns an unexpected value on devices running iOS 8+

This seems to be the offending line:

let unitList : [String] = ["year", "month", "week", "day", "hour", "minute", "second"]

This is likely due to the deprecation of the "week" property for NSDateComponents.

https://developer.apple.com/library/prerelease/ios/documentation/Cocoa/Reference/Foundation/Classes/NSDateComponents_Class/index.html

Changing to "weekOfYear" seems to have fixed things, but a nice check would be good to have in place to cover all bases and have a more reliable backwards compatibility.

@malcommac
Copy link
Owner

I plan to set the minimum req for SwiftDate to iOS8+, so your fix should be enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants