Skip to content

Initial NSDateFormatter tests #274

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

Merged
merged 4 commits into from
Mar 4, 2016

Conversation

tfrank64
Copy link
Contributor

@tfrank64 tfrank64 commented Mar 4, 2016

This PR primarily contains tests, but I also added CF attribute setters. I tried to use a wide variety of dates, but more could be added in the future.

More NSDateFormatter work coming in future pull requests.

@parkera
Copy link
Contributor

parkera commented Mar 4, 2016

@swift-ci please test

@parkera
Copy link
Contributor

parkera commented Mar 4, 2016

Thanks, always great to have more tests in place.

@tfrank64
Copy link
Contributor Author

tfrank64 commented Mar 4, 2016

Glad to help!

@phausler
Copy link
Contributor

phausler commented Mar 4, 2016

lgtm

phausler added a commit that referenced this pull request Mar 4, 2016
@phausler phausler merged commit 47fa18a into swiftlang:master Mar 4, 2016
@phausler
Copy link
Contributor

phausler commented Mar 4, 2016

wonder if this would prove to be useful for the person who made http://nsdateformatter.com

@tfrank64
Copy link
Contributor Author

tfrank64 commented Mar 4, 2016

Good question, I saw that yesterday and thought it would be helpful for me.

func test_dateStyleFull() {

let timestamps = [
-31536000 : "Wednesday, January 1, 1969 at 12:00:00 AM GMT" , 0.0 : "Thursday, January 1, 1970 at 12:00:00 AM GMT",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the correct value be Greenwich Mean Time instead of GMT?

That's what ICU spec says (http://userguide.icu-project.org/formatparse/datetime)
Also, that's the behaviour of f.timeStyle = .full on macOS.

It appears that for negative timestampts (e.g. -31536000) DateFormatter on macOS wrongly returns GMT instead of Greenwich Mean Time, which seems to be a bug.

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

Successfully merging this pull request may close these issues.

4 participants