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 error on Phone #15

Closed
iantheparker opened this issue Jun 13, 2015 · 5 comments
Closed

toRelativeString error on Phone #15

iantheparker opened this issue Jun 13, 2015 · 5 comments

Comments

@iantheparker
Copy link

Hello there,

This code seems to work fine on the simulator, but on my phone I get an error
cell.ageLabel.text = object.published_at.toRelativeString(fromDate: NSDate(), abbreviated: true, maxUnits: 1)
println("object published \(object.published_at) age label \(cell.ageLabel.text) and date \(NSDate())")

outputs on phone
object published 2015-06-11 15:34:56 +0000 age label Optional("9.223372e+18w") and date 2015-06-13 22:29:15 +0000

outputs on simulator
object published 2015-06-11 15:34:56 +0000 age label Optional("2 days ago") and date 2015-06-13 22:41:17 +0000

Any tips?

@brainloops
Copy link

Having the same issue. The "toRelativeString" method works fine on the simulator but fails on my actual device. (iPhone 6, iOS 8)

Instead of the nicely formatted "1h" or "37s", I get back what looks like scientific notation. "9.223372+18w"

@malcommac
Copy link
Owner

Thank you for your report. Seems to be an issue related to deprecated 'week' property of the NSDateComponent class. I've just made a commit here and tested with iOS 8.3 63bffa8. Can you make another check with your device?

@brainloops
Copy link

You bet. Tested the latest commit on my device and it's working perfectly.

Nailed it!

@malcommac
Copy link
Owner

Great :) Again, thank you for your bug report

@iantheparker
Copy link
Author

Great! Thank you!

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

3 participants