Skip to content

Compute Baseline high date from low date - #593

Merged
foolip merged 2 commits into
mainfrom
baseline_high_date
Feb 12, 2024
Merged

foolip merged 2 commits into
mainfrom
baseline_high_date

Conversation

@foolip

@foolip foolip commented Feb 12, 2024

Copy link
Copy Markdown
Collaborator

Fixes #522.

@foolip
foolip requested a review from ddbeck February 12, 2024 08:00
@foolip
foolip force-pushed the baseline_high_date branch from e421dd2 to 567662b Compare February 12, 2024 08:01
@foolip
foolip force-pushed the baseline_high_date branch from 567662b to 5ebaf01 Compare February 12, 2024 08:04
Comment thread index.ts Outdated
}
if (data.status?.baseline === 'high') {
const lowDate = Temporal.PlainDate.from(data.status.baseline_low_date);
const highDate = lowDate.add({ months: 30 });

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread index.ts Resolved
@foolip
foolip merged commit 89cddb0 into main Feb 12, 2024
@foolip
foolip deleted the baseline_high_date branch February 12, 2024 16:05
foolip added a commit that referenced this pull request Mar 13, 2024
Short name and Baseline high date have been added to the schema:
#545
#593

Many features have also been added.
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.

Question: will there be a baseline_high_date field?

3 participants