1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:37:44 +00:00

LibJS: Use existing variable instead of re-reading internal slot

This is an editorial change in the Temporal spec.

See: 8d62569
This commit is contained in:
Linus Groh 2022-06-14 23:51:50 +01:00
parent a7dfe9096c
commit 2ce3d4389a

View file

@ -1012,9 +1012,8 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::round)
// 16. Let startNs be instantStart.[[Nanoseconds]].
auto& start_ns = instant_start->nanoseconds();
// 17. Let endNs be ? AddZonedDateTime(startNs, timeZone, zonedDateTime.[[Calendar]], 0, 0, 0, 1, 0, 0, 0, 0, 0, 0).
// TODO: Shouldn't `zonedDateTime.[[Calendar]]` be `calendar` for consistency?
auto* end_ns = TRY(add_zoned_date_time(global_object, start_ns, &time_zone, zoned_date_time->calendar(), 0, 0, 0, 1, 0, 0, 0, 0, 0, 0));
// 17. Let endNs be ? AddZonedDateTime(startNs, timeZone, calendar, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0).
auto* end_ns = TRY(add_zoned_date_time(global_object, start_ns, &time_zone, calendar, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0));
// 18. Let dayLengthNs be (endNs - startNs).
auto day_length_ns = end_ns->big_integer().minus(start_ns.big_integer()).to_double();