Skip to content

[4.2] Fix DateFormatter behaviour for nil locale and timeZone. (#1681) #1981

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 1 commit into from
Mar 8, 2019

Conversation

spevans
Copy link
Contributor

@spevans spevans commented Mar 8, 2019

The locale and timeZone properties of DateFormatter seems to be "null
resetteable" in macOS, but the Swift Foundation behaviour differs.

Before this patch, setting locale to nil would segfault the program the
next time the formatter is used, while timeZone will incorrectly return
nil. After this patch a nil locale will simply reset to the current
locale and a nil timeZone will reset to the system one.

The tests check that the initial defaults are also correctly set.

(cherry picked from commit 1965003)

)

The locale and timeZone properties of DateFormatter seems to be "null
resetteable" in macOS, but the Swift Foundation behaviour differs.

Before this patch, setting locale to nil would segfault the program the
next time the formatter is used, while timeZone will incorrectly return
nil. After this patch a nil locale will simply reset to the current
locale and a nil timeZone will reset to the system one.

The tests check that the initial defaults are also correctly set.

(cherry picked from commit 1965003)
@spevans
Copy link
Contributor Author

spevans commented Mar 8, 2019

@swift-ci test 4.2

@spevans spevans requested a review from weissi March 8, 2019 16:21
Copy link
Contributor

@weissi weissi left a comment

Choose a reason for hiding this comment

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

thanks very much!

@weissi weissi merged commit 696a115 into swiftlang:swift-4.2-branch Mar 8, 2019
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.

3 participants