Skip to content

Commit

Permalink
Feedback from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
catamorphism authored and ptomato committed Oct 30, 2024
1 parent e85c025 commit 0bcb63b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 18 deletions.
17 changes: 0 additions & 17 deletions test/built-ins/Temporal/ZonedDateTime/prototype/add/overflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,6 @@ includes: [temporalHelpers.js]
features: [Temporal]
---*/

// subtract result
// var later = Temporal.ZonedDateTime.from("2019-10-29T10:46:38.271986102-03:00[-03:00]");
var later = new Temporal.ZonedDateTime(1572356798271986102n, "-03:00");
var earlier = later.subtract({ hours: 12 });

TemporalHelpers.assertZonedDateTimesEqual(
earlier,
// "2019-10-28T22:46:38.271986102-03:00[-03:00]"
new Temporal.ZonedDateTime(1572313598271986102n, "-03:00"));

// add result
// earlier = Temporal.ZonedDateTime.from("2020-05-31T23:12:38.271986102-04:00[-04:00]");
earlier = new Temporal.ZonedDateTime(1590981158271986102n, "-04:00");
Expand All @@ -34,10 +24,3 @@ earlier = new Temporal.ZonedDateTime(1572313598271986102n, "-03:00");

// symmetrical with regard to negative durations
TemporalHelpers.assertZonedDateTimesEqual(later.add({ hours: -12 }), earlier);

// "2020-05-31T23:12:38.271986102-04:00[-04:00]"
earlier = new Temporal.ZonedDateTime(1590981158271986102n, "-04:00");
later = new Temporal.ZonedDateTime(1590988358271986102n, "-04:00");

TemporalHelpers.assertZonedDateTimesEqual(earlier.subtract({ hours: -2 }), later);

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

/*---
esid: sec-temporal.zoneddatetime.prototype.equals
description: Different time zones not equal.
description: equals() casts its argument from string or object.
features: [Temporal]
---*/

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright (C) 2023 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-temporal.zoneddatetime.prototype.subtract
description: Hours overflow.
includes: [temporalHelpers.js]
features: [Temporal]
---*/

// subtract result
// var later = Temporal.ZonedDateTime.from("2019-10-29T10:46:38.271986102-03:00[-03:00]");
var later = new Temporal.ZonedDateTime(1572356798271986102n, "-03:00");
var earlier = later.subtract({ hours: 12 });

TemporalHelpers.assertZonedDateTimesEqual(
earlier,
// "2019-10-28T22:46:38.271986102-03:00[-03:00]"
new Temporal.ZonedDateTime(1572313598271986102n, "-03:00"));

// "2020-05-31T23:12:38.271986102-04:00[-04:00]"
earlier = new Temporal.ZonedDateTime(1590981158271986102n, "-04:00");
later = new Temporal.ZonedDateTime(1590988358271986102n, "-04:00");

TemporalHelpers.assertZonedDateTimesEqual(earlier.subtract({ hours: -2 }), later);

0 comments on commit 0bcb63b

Please sign in to comment.