temporal icon indicating copy to clipboard operation
temporal copied to clipboard

Update Duration.prototype.round to latest spec

Open sffc opened this issue 11 months ago • 8 comments

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.

sffc avatar Jan 28 '25 14:01 sffc


// 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.

Magnus-Fjeldstad avatar Jan 28 '25 15:01 Magnus-Fjeldstad

@Magnus-Fjeldstad Are you still working on this?

nekevss avatar Mar 01 '25 18:03 nekevss

Yes but i cant Get the tozonedatetime to work

Magnus-Fjeldstad avatar Mar 02 '25 21:03 Magnus-Fjeldstad

Sounds good.ToZonedDateTime would be an engine specific implementation item. round should still take the same arguments that it has.

For reference, the Boa implementation is here if you haven't seen it yet. If you have any questions, feel free to reach out in matrix.

nekevss avatar Mar 02 '25 22:03 nekevss

Thank you, ive been really busy lately but i will try to get some work done the following days. Hopefully a PR by next week.

Magnus-Fjeldstad avatar Mar 06 '25 11:03 Magnus-Fjeldstad

Sounds good. Feel free to reach out if you have any questions

nekevss avatar Mar 06 '25 14:03 nekevss

Hi this have proven to be to difficult for me, i will join @HenrikTennebekk and work on #142. Sorry for the inconvenience.

Magnus-Fjeldstad avatar Mar 18 '25 12:03 Magnus-Fjeldstad

Totally fine! It's has a lot of various nuances to it.

nekevss avatar Mar 18 '25 14:03 nekevss