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

testing zonedTimeToUtc daylight saving jumps #220

Merged
merged 1 commit into from Jan 24, 2023
Merged

Conversation

mcshaz
Copy link
Contributor

@mcshaz mcshaz commented Jan 11, 2023

This adds 6 tests for daylight savings. It tests what is returned by zonedTimeToUtc when the zoned time argument is during the times the local clock is moved forward or backwards.

It serves two main purposes:

  1. Documenting behaviour for developers - for instance when a local time is repeated (the local clock has been turned backwards), the latter occurence is returned. This is perfectly useful behaviour, but the test serves to document it and ensure it remains consistent between updates.
  2. As per the comments in the test, there is a question of what to do when a zoned time is provided which does not exist - for example when the zoned clock jumps from 01:59 to 03:00. At present the UTC time coresponding to zoned time at 01:00 is returned in the test which sets the zoned time to 02:00. The tests pass at the moment with this behaviour. Ultimately I believe either an error should be thrown, or the first time after (in this example, the UTC time corresponding to 03:00 zoned) returned, but that is a slightly separate issue to this pull request.

@marnusw
Copy link
Owner

marnusw commented Jan 24, 2023

Thank you

@marnusw marnusw merged commit 29e9356 into marnusw:master Jan 24, 2023
marnusw added a commit that referenced this pull request Jan 30, 2023
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.

None yet

2 participants