Source code
Revision control
Copy as Markdown
Other Tools
// |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.plaintime.from
description: Time separator in string argument can vary
features: [Temporal]
includes: [temporalHelpers.js]
---*/
const tests = [
["1976-11-18T12:34:56.987654321", "uppercase T"],
["1976-11-18t12:34:56.987654321", "lowercase T"],
["1976-11-18 12:34:56.987654321", "space between date and time"],
["T12:34:56.987654321", "time-only uppercase T"],
["t12:34:56.987654321", "time-only lowercase T"],
];
tests.forEach(([arg, description]) => {
const result = Temporal.PlainTime.from(arg);
TemporalHelpers.assertPlainTime(
result,
12, 34, 56, 987, 654, 321,
`variant time separators (${description})`
);
});
reportCompare(0, 0);