summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Temporal/PlainYearMonth/prototype/until/mixed-calendar-invalid.js
blob: c3e00f3d99b9fe548fc78f36adad4eea5a260f2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-temporal.plainyearmonth.prototype.until
description: Mixed calendars throw as invalid
features: [Temporal]
---*/

class customCal extends Temporal.Calendar {
  constructor () {
    super('iso8601');
  }

  get id() {
    return "I am a secret cal.";
  }
}

const ym1 = new Temporal.PlainYearMonth(2000, 1);
const ym2 = new Temporal.PlainYearMonth(2000, 1, new customCal());

assert.throws(RangeError, () => ym1.until(ym2), 'until throws with different calendars');

reportCompare(0, 0);