@@ -55,10 +55,10 @@ import {
55
55
NANOSECONDS
56
56
} from './slots' ;
57
57
import { IsBuiltinCalendar } from './calendar' ;
58
-
59
- const DAYMILLIS = 86400000 ;
60
- const NS_MIN = bigInt ( - 86400 ) . multiply ( 1e17 ) ;
61
- const NS_MAX = bigInt ( 86400 ) . multiply ( 1e17 ) ;
58
+ const DAY_SECONDS = 86400 ;
59
+ const DAY_NANOS = bigInt ( DAY_SECONDS ) . multiply ( 1e9 ) ;
60
+ const NS_MIN = bigInt ( - DAY_SECONDS ) . multiply ( 1e17 ) ;
61
+ const NS_MAX = bigInt ( DAY_SECONDS ) . multiply ( 1e17 ) ;
62
62
const YEAR_MIN = - 271821 ;
63
63
const YEAR_MAX = 275760 ;
64
64
const BEFORE_FIRST_DST = bigInt ( - 388152 ) . multiply ( 1e13 ) ; // 1847-01-01T00:00:00Z
@@ -2266,13 +2266,13 @@ export const ES = ObjectAssign({}, ES2020, {
2266
2266
return ES . BalanceISODateTime ( year , month , day , hour , minute , second , millisecond , microsecond , nanosecond ) ;
2267
2267
} ,
2268
2268
GetIANATimeZoneNextTransition : ( epochNanoseconds , id ) => {
2269
- const uppercap = ES . SystemUTCEpochNanoSeconds ( ) + 366 * DAYMILLIS * 1e6 ;
2269
+ const uppercap = ES . SystemUTCEpochNanoSeconds ( ) . plus ( DAY_NANOS . multiply ( 366 ) ) ;
2270
2270
let leftNanos = epochNanoseconds ;
2271
2271
const leftOffsetNs = ES . GetIANATimeZoneOffsetNanoseconds ( leftNanos , id ) ;
2272
2272
let rightNanos = leftNanos ;
2273
2273
let rightOffsetNs = leftOffsetNs ;
2274
2274
while ( leftOffsetNs === rightOffsetNs && bigInt ( leftNanos ) . compare ( uppercap ) === - 1 ) {
2275
- rightNanos = bigInt ( leftNanos ) . plus ( 2 * 7 * DAYMILLIS * 1e6 ) ;
2275
+ rightNanos = bigInt ( leftNanos ) . plus ( DAY_NANOS . multiply ( 2 * 7 ) ) ;
2276
2276
rightOffsetNs = ES . GetIANATimeZoneOffsetNanoseconds ( rightNanos , id ) ;
2277
2277
if ( leftOffsetNs === rightOffsetNs ) {
2278
2278
leftNanos = rightNanos ;
@@ -2295,7 +2295,7 @@ export const ES = ObjectAssign({}, ES2020, {
2295
2295
let leftNanos = rightNanos ;
2296
2296
let leftOffsetNs = rightOffsetNs ;
2297
2297
while ( rightOffsetNs === leftOffsetNs && bigInt ( rightNanos ) . compare ( lowercap ) === 1 ) {
2298
- leftNanos = bigInt ( rightNanos ) . minus ( 2 * 7 * DAYMILLIS * 1e6 ) ;
2298
+ leftNanos = bigInt ( rightNanos ) . minus ( DAY_NANOS . multiply ( 2 * 7 ) ) ;
2299
2299
leftOffsetNs = ES . GetIANATimeZoneOffsetNanoseconds ( leftNanos , id ) ;
2300
2300
if ( rightOffsetNs === leftOffsetNs ) {
2301
2301
rightNanos = leftNanos ;
@@ -2331,10 +2331,9 @@ export const ES = ObjectAssign({}, ES2020, {
2331
2331
GetIANATimeZoneEpochValue : ( id , year , month , day , hour , minute , second , millisecond , microsecond , nanosecond ) => {
2332
2332
const ns = ES . GetEpochFromISOParts ( year , month , day , hour , minute , second , millisecond , microsecond , nanosecond ) ;
2333
2333
if ( ns === null ) throw new RangeError ( 'DateTime outside of supported range' ) ;
2334
- const dayNanos = bigInt ( DAYMILLIS ) . multiply ( 1e6 ) ;
2335
- let nsEarlier = ns . minus ( dayNanos ) ;
2334
+ let nsEarlier = ns . minus ( DAY_NANOS ) ;
2336
2335
if ( nsEarlier . lesser ( NS_MIN ) ) nsEarlier = ns ;
2337
- let nsLater = ns . plus ( dayNanos ) ;
2336
+ let nsLater = ns . plus ( DAY_NANOS ) ;
2338
2337
if ( nsLater . greater ( NS_MAX ) ) nsLater = ns ;
2339
2338
const earliest = ES . GetIANATimeZoneOffsetNanoseconds ( nsEarlier , id ) ;
2340
2339
const latest = ES . GetIANATimeZoneOffsetNanoseconds ( nsLater , id ) ;
0 commit comments