mirror of
				https://github.com/tc39/test262.git
				synced 2025-11-04 05:33:50 +01:00 
			
		
		
		
	Tests for the normative changes made to Temporal in https://github.com/tc39/proposal-temporal/pull/1874
		
			
				
	
	
		
			27 lines
		
	
	
		
			858 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			858 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
 | 
						|
// This code is governed by the BSD license found in the LICENSE file.
 | 
						|
 | 
						|
/*---
 | 
						|
esid: sec-temporal.plaindatetime.compare
 | 
						|
description: RangeError thrown if a string with UTC designator is used as a PlainDateTime
 | 
						|
features: [Temporal, arrow-function]
 | 
						|
---*/
 | 
						|
 | 
						|
const invalidStrings = [
 | 
						|
  "2019-10-01T09:00:00Z",
 | 
						|
  "2019-10-01T09:00:00Z[UTC]",
 | 
						|
];
 | 
						|
const dateTime = new Temporal.PlainDateTime(2000, 5, 2);
 | 
						|
invalidStrings.forEach((arg) => {
 | 
						|
  assert.throws(
 | 
						|
    RangeError,
 | 
						|
    () => Temporal.PlainDateTime.compare(arg, dateTime),
 | 
						|
    "String with UTC designator should not be valid as a PlainDateTime (first argument)"
 | 
						|
  );
 | 
						|
  assert.throws(
 | 
						|
    RangeError,
 | 
						|
    () => Temporal.PlainDateTime.compare(arg, dateTime),
 | 
						|
    "String with UTC designator should not be valid as a PlainDateTime (second argument)"
 | 
						|
  );
 | 
						|
});
 |