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

Adapt Datetime parser to DST timezones #1524

Merged

Conversation

diachenko-mischa
Copy link
Collaborator

When iOS device locale is set to location
which uses different timezeons depending on
daylight saving time (eg PST and PDT for
Los Angeles), then different gmtoff applied
by strptime for 'summer' and 'winter'
timestamps.

This results in the wrong translation of
datetime string into epoch.

Adapt code to iOS/MacOS behaviour, where
timegm updates an input parameter and
erases gmtoff value:

  • remove logic to infer the offset using epoch datetime;
  • store gmtoff value before calling timegm;
  • offset result returned from timegm by saved gmtoff.

Relates-To: HERESDK-2568

When iOS device locale is set to location
which uses different timezeons depending on
daylight saving time (eg PST and PDT for
Los Angeles), then different `gmtoff` applied
by `strptime` for 'summer' and 'winter'
timestamps.

This results in the wrong translation of
datetime string into epoch.

Adapt code to iOS/MacOS behaviour, where
`timegm` updates an input parameter and
erases `gmtoff` value:
- remove logic to infer the offset using epoch
  datetime;
- store `gmtoff` value before calling `timegm`;
- offset result returned from `timegm` by
  saved `gmtoff`.

Relates-To: HERESDK-2568

Signed-off-by: Mykhailo Diachenko <[email protected]>
Copy link

codecov bot commented Jun 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.45%. Comparing base (3dddc67) to head (3e44c6f).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1524      +/-   ##
==========================================
- Coverage   81.47%   81.45%   -0.01%     
==========================================
  Files         344      344              
  Lines       13542    13538       -4     
  Branches     1455     1456       +1     
==========================================
- Hits        11032    11027       -5     
- Misses       1917     1919       +2     
+ Partials      593      592       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ystefinko ystefinko merged commit 3e8c222 into master Jun 20, 2024
20 checks passed
@ystefinko ystefinko deleted the mdiachenko/HERESDK-2568-AdaptDatetimeParserToDstTimezones branch June 20, 2024 10:13
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