Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[JSC] Fix Temporal regulateTime's constraints for milliseconds, micro…
…seconds, and nanoseconds https://bugs.webkit.org/show_bug.cgi?id=241818 rdar://95534859 Reviewed by Ross Kirsling. This patch fixes constraints for milliseconds, microseconds, and nanoseconds in constrainTime. It should be from 0 to 999, not to 1000[1]. [1]: https://tc39.es/proposal-temporal/#sec-temporal-constraintime * JSTests/stress/temporal-plaintime-tostring-1000-millisecond.js: Added. (shouldBe): (throw.new.Error): * Source/JavaScriptCore/runtime/TemporalPlainTime.cpp: (JSC::constrainTime): Canonical link: https://commits.webkit.org/251698@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@295693 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
1 parent
c337b98
commit 9b4ed78
Showing
2 changed files
with
46 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
//@ requireOptions("--useTemporal=1") | ||
|
||
function shouldBe(actual, expected) { | ||
if (actual !== expected) | ||
throw new Error('bad value: ' + actual); | ||
} | ||
|
||
{ | ||
let data = Temporal.PlainTime.from({ | ||
hour: 0, | ||
minute: 0, | ||
second: 0, | ||
millisecond: 1000, | ||
microsecond: 0, | ||
nanosecond: 0, | ||
}).toString(); | ||
|
||
shouldBe(data, `00:00:00.999`); | ||
} | ||
{ | ||
let data = Temporal.PlainTime.from({ | ||
hour: 0, | ||
minute: 0, | ||
second: 0, | ||
millisecond: 0, | ||
microsecond: 1000, | ||
nanosecond: 0, | ||
}).toString(); | ||
|
||
shouldBe(data, `00:00:00.000999`); | ||
} | ||
{ | ||
let data = Temporal.PlainTime.from({ | ||
hour: 0, | ||
minute: 0, | ||
second: 0, | ||
millisecond: 0, | ||
microsecond: 0, | ||
nanosecond: 1000, | ||
}).toString(); | ||
|
||
shouldBe(data, `00:00:00.000000999`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters