Sync to PR701 (#3609)

In 2022-07-20 TC39 we decide to take 
https://github.com/tc39/ecma402/pull/701 and not check the order of the x and y 
see https://docs.google.com/presentation/d/1UUvbf3FFu9PGtrPAKPdMad9DZuVFLIvkAsAxyJZyvxM/ for details
This commit is contained in:
Frank Yung-Fong Tang 2022-07-21 13:30:08 -07:00 committed by GitHub
parent 7b2a9bb441
commit ab29fd3225
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 15 deletions

View File

@ -1,9 +1,9 @@
// Copyright 2019 Google, Inc. All rights reserved.
// Copyright 2022 Google, Inc. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
Throws a RangeError if date x is greater than y.
Return a string if date x is greater than y.
info: |
Intl.DateTimeFormat.prototype.formatRange ( startDate , endDate )
@ -17,7 +17,6 @@ info: |
2. If x is NaN, throw a RangeError exception.
3. Let y be TimeClip(y).
4. If y is NaN, throw a RangeError exception.
5. If x is greater than y, throw a RangeError exception.
features: [Intl.DateTimeFormat-formatRange]
---*/
@ -28,10 +27,7 @@ var x = new Date();
var y = new Date();
x.setDate(y.getDate() + 1);
assert.throws(RangeError, function() {
dtf.formatRange(x, y);
}, "x > y");
assert.sameValue("string", typeof dtf.formatRange(x, y));
assert.sameValue("string", typeof dtf.formatRange(x, x));
assert.sameValue("string", typeof dtf.formatRange(y, y));
assert.sameValue("string", typeof dtf.formatRange(y, x));

View File

@ -1,9 +1,9 @@
// Copyright 2019 Google, Inc. All rights reserved.
// Copyright 2022 Google, Inc. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
Throws a RangeError if date x is greater than y.
Return an object if date x is greater than y.
info: |
Intl.DateTimeFormat.prototype.formatRangeToParts ( startDate , endDate )
@ -12,13 +12,10 @@ info: |
6. Return ? FormatDateTimeRangeToParts(dtf, x, y).
PartitionDateTimeRangePattern ( dateTimeFormat, x, y )
1. Let x be TimeClip(x).
2. If x is NaN, throw a RangeError exception.
3. Let y be TimeClip(y).
4. If y is NaN, throw a RangeError exception.
5. If x is greater than y, throw a RangeError exception.
features: [Intl.DateTimeFormat-formatRange]
---*/
@ -28,9 +25,7 @@ var x = new Date();
var y = new Date();
x.setDate(y.getDate() + 1);
assert.throws(RangeError, function() {
dtf.formatRangeToParts(x, y);
}, "x > y");
assert.sameValue("object", typeof dtf.formatRangeToParts(x, y));
assert.sameValue("object", typeof dtf.formatRangeToParts(x, x));
assert.sameValue("object", typeof dtf.formatRangeToParts(y, y));
assert.sameValue("object", typeof dtf.formatRangeToParts(y, x));