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

Update Duration.prototype.round to latest spec #188

Open
sffc opened this issue Jan 28, 2025 · 1 comment
Open

Update Duration.prototype.round to latest spec #188

sffc opened this issue Jan 28, 2025 · 1 comment

Comments

@sffc
Copy link
Contributor

sffc commented Jan 28, 2025

This function appears to be written against an old version of the spec. It is hard to verify correctness and update it to use the newer AOs.

@Magnus-Fjeldstad
Copy link
Contributor

// 27. If plainRelativeTo is not undefined, then
                // a. Let internalDuration be ToInternalDurationRecordWith24HourDays(duration).
                let time_duration = self.time.to_normalized().add_days(self.days().as_())?;
                // b. Let targetTime be AddTime(MidnightTimeRecord(), internalDuration.[[Time]]).
                let target_time = PlainTime::default().add_normalized_time_duration(time_duration);
                // c. Let calendar be plainRelativeTo.[[Calendar]].

                // d. Let dateDuration be ! AdjustDateDurationRecord(internalDuration.[[Date]], targetTime.[[Days]]).
                let date_duration = date_duration.adjust(target_time.0.into(), None, None)?;

Started to update the round_with_provider method, within duration.rs.

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

No branches or pull requests

2 participants