Skip to content

Commit 922cb5e

Browse files
justingrantryzokuken
authored andcommitted
Clarify invalid duration field error message
1 parent 9a73f75 commit 922cb5e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

polyfill/lib/ecmascript.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,9 @@ export const ES = ObjectAssign({}, ES2020, {
571571
ES.RejectDuration(years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds);
572572
for (const property of disallowedProperties) {
573573
if (record[property] !== 0) {
574-
throw new RangeError(`invalid duration field ${property}`);
574+
throw new RangeError(
575+
`Duration field ${property} not supported by Temporal.Instant. Try Temporal.ZonedDateTime instead.`
576+
);
575577
}
576578
}
577579
return record;

0 commit comments

Comments
 (0)