Skip to content

Since until #259

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

Merged
merged 17 commits into from
Apr 9, 2025
Merged

Since until #259

merged 17 commits into from
Apr 9, 2025

Conversation

sebastianjacmatt
Copy link
Contributor

fixes #142

Worked with @HenrikTennebekk and @Magnus-Fjeldstad
Implementation for since and until in PlainYearMonth, has not yet been tested with boa test262

Copy link
Member

@nekevss nekevss left a comment

Choose a reason for hiding this comment

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

Looks great! All the extra tests looks great!

I had one thing I noticed and then a general thought/nit (this one isn't necessarily blocking though). Although, it does look like there are some clippy lints that need to be fixed as well to be able to merge.

// 15. Let duration be CombineDateAndTimeDuration(yearsMonthsDifference, 0).
let mut duration = NormalizedDurationRecord::from_date_duration(*result.date())?;
// 16. If settings.[[SmallestUnit]] is not month or settings.[[RoundingIncrement]] ≠ 1, then
if settings.smallest_unit != Some(TemporalUnit::Month)
Copy link
Member

Choose a reason for hiding this comment

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

issue: I believe this should be using the resolved options in resolved.

src/options.rs Outdated
// 1. NOTE: The following steps read options and perform independent validation in alphabetical order.
// 2. Let largestUnit be ? GetTemporalUnitValuedOption(options, "largestUnit", unitGroup, auto).
// Week and day is the only use case where any of the units are not allowed.
if dissallow_week_and_day {
Copy link
Member

Choose a reason for hiding this comment

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

thought: is there anything preventing moving this into PlainYearMonth::diff vs. where it's currently at in ResolvedRoundingOptions::from_diff_settings.

This only affects the one code path from PlainYearMonth, I think, so maybe this could work in PlainYearMonth::diff. This would then avoid the check occurring for the other callers.

Magnus-Fjeldstad and others added 2 commits April 9, 2025 15:29
…resolved from settings in diff and moved logic from options.rs from_diff_setting into diff
Copy link
Member

@nekevss nekevss left a comment

Choose a reason for hiding this comment

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

Looks good to me! Thanks for working on this!

EDIT: I think all this needs is a rebase / merge and it should be good to go

@nekevss nekevss merged commit d65c641 into boa-dev:main Apr 9, 2025
8 checks passed
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.

Implement since and until methods for PlainYearMonth
4 participants