Repository navigation
Compute Baseline high date from low date - #593
Merged
Merged
Conversation
foolip
force-pushed
the
baseline_high_date
branch
from
February 12, 2024 08:01
e421dd2 to
567662b
Compare
foolip
force-pushed
the
baseline_high_date
branch
from
February 12, 2024 08:04
567662b to
5ebaf01
Compare
ddbeck
approved these changes
Feb 12, 2024
foolip
commented
Feb 12, 2024
| } | ||
| if (data.status?.baseline === 'high') { | ||
| const lowDate = Temporal.PlainDate.from(data.status.baseline_low_date); | ||
| const highDate = lowDate.add({ months: 30 }); |
Collaborator
Author
There was a problem hiding this comment.
The behavior is to clamp to the end of the month if the day of the month in lowDate is higher than the number of days in the resulting months. This is different from what this code would do:
d=new Date('2020-08-31')
d.setMonth(d.getMonth()+30)That results in 2023-03-03, where Temporal will give us 2023-02-28. Doesn't matter much, but it's a nice property that all things in one month will map to the same future month.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #522.