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

Timezone Issue #76

Open
fjcaetano opened this issue Jun 22, 2016 · 3 comments
Open

Timezone Issue #76

fjcaetano opened this issue Jun 22, 2016 · 3 comments

Comments

@fjcaetano
Copy link

We're using the timer labels as countdowns to deadline dates. However, whenever a deadline is in two different days because of timezone differences, the label shows the incorrect number of days remaining.

Example: If a deadline is set to 2016-06-23 1am (UTC), if the device's timezone is UTC-4, the deadline would end at 2016-06-22 9p.m (UTC-4). And instead of the label showing "0d 2h 27m" it shows "1d 2h 27m".

We were able to fix this issue by removing this line that reads.

        [_dateFormatter setTimeZone:[NSTimeZone timeZoneWithName:@"GMT"]];

However we don't know how this change would impact other users, so we didn't apply for a pull-request yet.

@ankraft
Copy link

ankraft commented Aug 1, 2016

My opinion is that the time zones of the supplied dates should apply.
Is there a reason that the line mentioned sets the time zone explicitly?

@fjcaetano
Copy link
Author

The problem is that the supplied timezone is being applied, but the device's timezone is being ignored, which creates the issue described.

Both should be used to calculate the correct time difference, but when the "GMT" timezone is given to the formatter, it assumes the device is in the +0 timezone which, not necessarily, is true and the time difference calculated is towards the GMT timezone and not the true timezone where the device is.

That's why I said that removing that line solves the issue, because the device's timezone starts being taken into account.

@ankraft
Copy link

ankraft commented Aug 1, 2016

What I meant: I agree with you. Applying "GMT" for only one date (start or target) would break the date calculations.
I am using the timer label only in stopwatch mode in my app, not countdown, so I cannot give you any advice. But I guess the fix you suggested can easily be tested for various time zones with the demo app.

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

2 participants