-
Notifications
You must be signed in to change notification settings - Fork 160
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
Implement arithmetic and rounding relative to ZonedDateTime #1171
Labels
Milestone
Comments
This was referenced Nov 10, 2020
Merged
ptomato
added a commit
that referenced
this issue
Nov 12, 2020
This splits the rounding operation out of DifferenceZonedDateTime. It should be followed by RoundDuration and then by AdjustRoundedDurationDays if necessary. This also allows RoundDuration to take a ZonedDateTime as its relativeTo parameter (though it doesn't work yet in all cases.) AdjustRoundedDurationDays does a second round operation if the time part of the duration has rounded up to exceed the day length. It should be called after AdjustRoundedDurationDays if necessary. Sometimes it is not: it's only needed if relativeTo is a ZonedDateTime, and it's not needed in Duration.total() (because the fractional days returned would be the same regardless.) See: #1171
ptomato
added a commit
that referenced
this issue
Nov 12, 2020
This new abstract operation will be used in more places when converting nanoseconds to time-zone-aware days. See: #1171
ptomato
added a commit
that referenced
this issue
Nov 12, 2020
These tests don't work yet, but it's nonetheless good to have them reviewed and landed in the test suite. See: #1171
ptomato
added a commit
that referenced
this issue
Nov 12, 2020
This splits the rounding operation out of DifferenceZonedDateTime. It should be followed by RoundDuration and then by AdjustRoundedDurationDays if necessary. This also allows RoundDuration to take a ZonedDateTime as its relativeTo parameter (though it doesn't work yet in all cases.) AdjustRoundedDurationDays does a second round operation if the time part of the duration has rounded up to exceed the day length. It should be called after AdjustRoundedDurationDays if necessary. Sometimes it is not: it's only needed if relativeTo is a ZonedDateTime, and it's not needed in Duration.total() (because the fractional days returned would be the same regardless.) See: #1171
ptomato
added a commit
that referenced
this issue
Nov 12, 2020
This new abstract operation will be used in more places when converting nanoseconds to time-zone-aware days. See: #1171
ptomato
added a commit
that referenced
this issue
Nov 12, 2020
These tests don't work yet, but it's nonetheless good to have them reviewed and landed in the test suite. See: #1171
ptomato
added a commit
that referenced
this issue
Nov 12, 2020
This splits the rounding operation out of DifferenceZonedDateTime. It should be followed by RoundDuration and then by AdjustRoundedDurationDays if necessary. This also allows RoundDuration to take a ZonedDateTime as its relativeTo parameter (though it doesn't work yet in all cases.) AdjustRoundedDurationDays does a second round operation if the time part of the duration has rounded up to exceed the day length. It should be called after AdjustRoundedDurationDays if necessary. Sometimes it is not: it's only needed if relativeTo is a ZonedDateTime, and it's not needed in Duration.total() (because the fractional days returned would be the same regardless.) See: #1171
ptomato
added a commit
that referenced
this issue
Nov 12, 2020
This new abstract operation will be used in more places when converting nanoseconds to time-zone-aware days. See: #1171
ptomato
added a commit
that referenced
this issue
Nov 12, 2020
These tests don't work yet, but it's nonetheless good to have them reviewed and landed in the test suite. See: #1171
ptomato
added a commit
that referenced
this issue
Nov 13, 2020
This new abstract operation will be used in more places when converting nanoseconds to time-zone-aware days. See: #1171
ptomato
added a commit
that referenced
this issue
Nov 13, 2020
These tests don't work yet, but it's nonetheless good to have them reviewed and landed in the test suite. See: #1171
ptomato
added a commit
that referenced
this issue
Nov 13, 2020
These tests don't work yet, but it's nonetheless good to have them reviewed and landed in the test suite. See: #1171
ptomato
added a commit
that referenced
this issue
Nov 13, 2020
This splits the rounding operation out of DifferenceZonedDateTime. It should be followed by RoundDuration and then by AdjustRoundedDurationDays if necessary. This also allows RoundDuration to take a ZonedDateTime as its relativeTo parameter (though it doesn't work yet in all cases.) AdjustRoundedDurationDays does a second round operation if the time part of the duration has rounded up to exceed the day length. It should be called after AdjustRoundedDurationDays if necessary. Sometimes it is not: it's only needed if relativeTo is a ZonedDateTime, and it's not needed in Duration.total() (because the fractional days returned would be the same regardless.) See: #1171
ptomato
added a commit
that referenced
this issue
Nov 13, 2020
This new abstract operation will be used in more places when converting nanoseconds to time-zone-aware days. See: #1171
ptomato
added a commit
that referenced
this issue
Nov 13, 2020
These tests don't work yet, but it's nonetheless good to have them reviewed and landed in the test suite. See: #1171
ptomato
added a commit
that referenced
this issue
Nov 13, 2020
duration.add(other, { relativeTo }) is by definition equal to relativeTo.until(relativeTo.add(duration).add(other)), so rewrite AddDuration to work that way. See: #1171
ptomato
added a commit
that referenced
this issue
Nov 13, 2020
Adds a day length parameter to RoundDateTime and RoundTime in order to take non-24-hour days into account when rounding a time to the nearest day. See: #1171
Ms2ger
added a commit
that referenced
this issue
Nov 13, 2020
Adds a day length parameter to RoundDateTime and RoundTime in order to take non-24-hour days into account when rounding a time to the nearest day. See: #1171 Co-authored-by: Ms2ger <[email protected]>
Ms2ger
pushed a commit
that referenced
this issue
Nov 13, 2020
duration.add(other, { relativeTo }) is by definition equal to relativeTo.until(relativeTo.add(duration).add(other)), so rewrite AddDuration to work that way. See: #1171
Ms2ger
added a commit
that referenced
this issue
Nov 13, 2020
Adds a day length parameter to RoundDateTime and RoundTime in order to take non-24-hour days into account when rounding a time to the nearest day. See: #1171 Co-authored-by: Ms2ger <[email protected]>
ptomato
added a commit
that referenced
this issue
Nov 13, 2020
In case you need to round the remainder of nanoseconds to the nearest day, you need to know how long the day is. This will be used to fix rounding relative to a ZonedDateTime. See: #1171
ptomato
added a commit
that referenced
this issue
Nov 13, 2020
When rounding or totaling time units, the length of the last day needs to be taken into account if relativeTo is a ZonedDateTime. This fixes some of the broken test cases. See: #1171
ptomato
added a commit
that referenced
this issue
Nov 13, 2020
When converting between days and lower units in BalanceDuration, we need to take the offset shift into account, and likewise when converting between lower units and days, we need to take the length of the last day into account. See: #1171
ptomato
added a commit
that referenced
this issue
Nov 14, 2020
In case you need to round the remainder of nanoseconds to the nearest day, you need to know how long the day is. This will be used to fix rounding relative to a ZonedDateTime. See: #1171
ptomato
added a commit
that referenced
this issue
Nov 14, 2020
When rounding or totaling time units, the length of the last day needs to be taken into account if relativeTo is a ZonedDateTime. This fixes some of the broken test cases. See: #1171
ptomato
added a commit
that referenced
this issue
Nov 14, 2020
When converting between days and lower units in BalanceDuration, we need to take the offset shift into account, and likewise when converting between lower units and days, we need to take the length of the last day into account. See: #1171
ptomato
added a commit
that referenced
this issue
Nov 14, 2020
When converting between days and lower units in BalanceDuration, we need to take the exact time into account, and likewise when converting between lower units and days, we need to take the length of the last day into account. See: #1171
ptomato
added a commit
that referenced
this issue
Nov 15, 2020
When converting between days and lower units in BalanceDuration, we need to take the exact time into account, and likewise when converting between lower units and days, we need to take the length of the last day into account. See: #1171
ptomato
added a commit
that referenced
this issue
Nov 15, 2020
When converting between days and lower units in BalanceDuration, we need to take the exact time into account, and likewise when converting between lower units and days, we need to take the length of the last day into account. As well, we need to take into account the possibility of moving the time forward when adding, due to disambiguation. These were handled correctly in DifferenceZonedDateTime but not in NanosecondsToDays. In order to ensure that these algorithms don't diverge, move all the important stuff from DifferenceZonedDateTime into NanosecondsToDays, and use NanosecondsToDays in DifferenceZonedDateTime. See: #1171
Ms2ger
pushed a commit
that referenced
this issue
Nov 16, 2020
In case you need to round the remainder of nanoseconds to the nearest day, you need to know how long the day is. This will be used to fix rounding relative to a ZonedDateTime. See: #1171
Ms2ger
pushed a commit
that referenced
this issue
Nov 16, 2020
When rounding or totaling time units, the length of the last day needs to be taken into account if relativeTo is a ZonedDateTime. This fixes some of the broken test cases. See: #1171
Ms2ger
pushed a commit
that referenced
this issue
Nov 16, 2020
When converting between days and lower units in BalanceDuration, we need to take the exact time into account, and likewise when converting between lower units and days, we need to take the length of the last day into account. As well, we need to take into account the possibility of moving the time forward when adding, due to disambiguation. These were handled correctly in DifferenceZonedDateTime but not in NanosecondsToDays. In order to ensure that these algorithms don't diverge, move all the important stuff from DifferenceZonedDateTime into NanosecondsToDays, and use NanosecondsToDays in DifferenceZonedDateTime. See: #1171
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
This is a separate issue that covers the last point in the checklists in #856 and #569, which are actually the same thing. I suspect that all the code for these is the same.
The text was updated successfully, but these errors were encountered: