2022-04-13 16:39:41 +02:00
|
|
|
// 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.plaindatetime.from
|
2023-06-10 19:17:39 +02:00
|
|
|
description: A number cannot be used in place of a Temporal.PlainDateTime
|
2022-04-18 20:16:54 +02:00
|
|
|
features: [Temporal]
|
2022-04-13 16:39:41 +02:00
|
|
|
---*/
|
|
|
|
|
2022-04-18 20:16:54 +02:00
|
|
|
const numbers = [
|
|
|
|
1,
|
2023-06-10 19:17:39 +02:00
|
|
|
19761118,
|
2022-04-18 20:16:54 +02:00
|
|
|
-19761118,
|
|
|
|
1234567890,
|
|
|
|
];
|
2022-04-13 16:39:41 +02:00
|
|
|
|
2022-04-18 20:16:54 +02:00
|
|
|
for (const arg of numbers) {
|
|
|
|
assert.throws(
|
2023-06-10 19:17:39 +02:00
|
|
|
TypeError,
|
2022-04-18 20:16:54 +02:00
|
|
|
() => Temporal.PlainDateTime.from(arg),
|
2023-06-07 10:51:52 +02:00
|
|
|
`A number (${arg}) is not a valid ISO string for PlainDateTime`
|
2022-04-18 20:16:54 +02:00
|
|
|
);
|
|
|
|
}
|