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

Converting a time zone should be done by changing region, not with UTC and time zone funcs #99

Closed
Hout opened this issue Dec 7, 2015 · 3 comments
Assignees
Milestone

Comments

@Hout
Copy link
Contributor

Hout commented Dec 7, 2015

Currently the funcs fromTimeZone and inUTCDate complicate conversions. Converting should be as easy as:

let date1 = NSDate()

// I want to know the time here locally and in China
let china = Region(timeZone: chinaTimeZone)
let date2 = date1.inRegion(china)

// Now let us see what we have
print(date1.hour)  // prints the local hour
print(date2.hour)  // prints the hour in china in our calendar and locale

Mind that this is pseudo code to illustrate the issue.

@Hout Hout self-assigned this Dec 7, 2015
@malcommac
Copy link
Owner

So should be like current inRegion() function but it takes directly the timezone to create a default region without passing other optional params?

@Hout
Copy link
Contributor Author

Hout commented Dec 13, 2015

Correct, as implemented in fd73ef7

@Hout Hout added this to the v2.1 milestone Dec 13, 2015
@Hout
Copy link
Contributor Author

Hout commented Jan 23, 2016

Fixed in v3.0.0

@Hout Hout closed this as completed Jan 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants