-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GetUTCEpochNanoseconds: Replace MakeDay/MakeDate with ISODateToEpochDays/EpochDaysToEpochMs #2729
Comments
I'd like to avoid rewriting GetUTCEpochNanoseconds in ECMA-262 because until the question about large Number values (tc39/ecma262#1087) is clarified, we don't know whether that would be a normative change for legacy As far as I can tell, the places where this potentially happens is in ISODateTimeWithinLimits and the string branch of ToTemporalInstant. The other places where GetUTCEpochNanoseconds is called:
So I think we can handle this with an extra "If abs(ISODateToEpochDays(year, month - 1, day)) > 108" check in ISODateTimeWithinLimits and ToTemporalInstant. Does that sound good to you? |
GetUTCEpochNanoseconds has an assertion that MakeDate, MakeTime, and MakeDay all result in a finite value. However, several places call GetUTCEpochNanoseconds with a year value that may be excessively large, notably from parsing an ISO string such as +999999-01-01, which would cause that assertion to be hit. Add checks in the appropriate places to make sure that the year value is not excessively large. Closes: #2729
Ah, I forgot that |
This pattern is there because of #2729 and #2985. Abstract it into its own operation, for documentation purposes and because it can disappear after tc39/ecma262#1087 is fixed. See: #3005
This pattern is there because of #2729 and #2985. Abstract it into its own operation, for documentation purposes and because it can disappear after tc39/ecma262#1087 is fixed. See: #3005
Continuation of #2315:
GetUTCEpochNanoseconds
can be called with user-definedyear
, which can be too large forMakeDay
/MakeDate
. InsteadISODateToEpochDays
andEpochDaysToEpochMs
have to be used inGetUTCEpochNanoseconds
.The text was updated successfully, but these errors were encountered: