mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-05 23:59:49 +00:00
LibJS: Make ToDateDurationRecordWithoutTime infallible
This is an editorial change in the Temporal proposal. See:
05017b9
This commit is contained in:
parent
4f07cddb2d
commit
4cbb5661d0
Notes:
github-actions[bot]
2024-12-05 21:07:00 +00:00
Author: https://github.com/trflynn89
Commit: 4cbb5661d0
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2790
Reviewed-by: https://github.com/gmta ✅
4 changed files with 8 additions and 8 deletions
|
@ -110,7 +110,7 @@ InternalDuration to_internal_duration_record_with_24_hour_days(VM& vm, Duration
|
|||
}
|
||||
|
||||
// 7.5.7 ToDateDurationRecordWithoutTime ( duration ), https://tc39.es/proposal-temporal/#sec-temporal-todatedurationrecordwithouttime
|
||||
ThrowCompletionOr<DateDuration> to_date_duration_record_without_time(VM& vm, Duration const& duration)
|
||||
DateDuration to_date_duration_record_without_time(VM& vm, Duration const& duration)
|
||||
{
|
||||
// 1. Let internalDuration be ToInternalDurationRecordWith24HourDays(duration).
|
||||
auto internal_duration = to_internal_duration_record_with_24_hour_days(vm, duration);
|
||||
|
@ -118,8 +118,8 @@ ThrowCompletionOr<DateDuration> to_date_duration_record_without_time(VM& vm, Dur
|
|||
// 2. Let days be truncate(internalDuration.[[Time]] / nsPerDay).
|
||||
auto days = internal_duration.time.divided_by(NANOSECONDS_PER_DAY).quotient;
|
||||
|
||||
// 3. Return ? CreateDateDurationRecord(internalDuration.[[Date]].[[Years]], internalDuration.[[Date]].[[Months]], internalDuration.[[Date]].[[Weeks]], days).
|
||||
return TRY(create_date_duration_record(vm, duration.years(), duration.months(), duration.weeks(), days.to_double()));
|
||||
// 3. Return ! CreateDateDurationRecord(internalDuration.[[Date]].[[Years]], internalDuration.[[Date]].[[Months]], internalDuration.[[Date]].[[Weeks]], days).
|
||||
return MUST(create_date_duration_record(vm, duration.years(), duration.months(), duration.weeks(), days.to_double()));
|
||||
}
|
||||
|
||||
// 7.5.8 TemporalDurationFromInternal ( internalDuration, largestUnit ), https://tc39.es/proposal-temporal/#sec-temporal-temporaldurationfrominternal
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue