-
Notifications
You must be signed in to change notification settings - Fork 59
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
SwiftyChrono - It gives from different timezone. Is there any option to change the timezone ? #17
Comments
can you print the refDate? the default Swift Date constructor is located to local time and Date itself doesn't contain the concept of timezone. |
now the time is 26 march 11pm. Scenarios-
// the time has gone, so expected output is tomorrow's date i.e. 27 march 9 pm which is wrong
// the time has yet to come, so expected output is 26 march 11.15 pm which is correct3.if i use ref date as Date().toLocalDate() and the text is "at 9 pm" func toLocalTime() -> Date { // the time has gone, so expected output is 27 march 9 pm which is correct4.if i use ref date as Date().toLocalDate() and the text is "at 11.15 pm" func toLocalTime() -> Date { // the time has gone, so expected output is 26 march 11.15 pm which is wrongso, even using either of reference date (local date or direct date) one scenario passes and one fails (scenario are 1. time yet to come, 2. time which has pass) |
added opt: [.forwardDate: 1] as well. |
In simple words, now time is 27 march 2020, 12.42 am Input -> at 12:15 am excepted output -> 28 march 2020, 12:15 am real output -> 27 march 2020, 12:15 am |
how to change the time zone?
right now, I'm passing refdate as my local time
so in some scenarios it is showing right and some it shows according to different timezone.
Output-
Optional(2019-12-28 06:30:00 +0000) //different time zone
Optional(2019-12-27 11:30:00 +0000) //different time zone
Optional(2019-12-27 15:49:03 +0000) //right
The text was updated successfully, but these errors were encountered: