@nubjs/nub-linux-x64 0.0.5 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/nub +0 -0
- package/package.json +1 -1
- package/runtime/addons/nub-native.node +0 -0
- package/runtime/cache-evict.mjs +69 -0
- package/runtime/node_modules/@js-temporal/polyfill/CHANGELOG.md +453 -0
- package/runtime/node_modules/@js-temporal/polyfill/LICENSE +13 -0
- package/runtime/node_modules/@js-temporal/polyfill/README.md +90 -0
- package/runtime/node_modules/@js-temporal/polyfill/dist/index.cjs +2 -0
- package/runtime/node_modules/@js-temporal/polyfill/dist/index.cjs.map +1 -0
- package/runtime/node_modules/@js-temporal/polyfill/dist/index.esm.js +2 -0
- package/runtime/node_modules/@js-temporal/polyfill/dist/index.esm.js.map +1 -0
- package/runtime/node_modules/@js-temporal/polyfill/dist/index.umd.js +2 -0
- package/runtime/node_modules/@js-temporal/polyfill/dist/index.umd.js.map +1 -0
- package/runtime/node_modules/@js-temporal/polyfill/index.d.cts +1215 -0
- package/runtime/node_modules/@js-temporal/polyfill/index.d.ts +1215 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/assert.ts +8 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/bigintmath.ts +39 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/calendar.ts +2424 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/debug.ts +7 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/duration.ts +438 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/durationformat.d.ts +93 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/ecmascript.ts +4973 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/index.ts +34 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/init.ts +43 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/instant.ts +138 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/internaltypes.d.ts +242 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/intl.ts +758 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/intrinsicclass.ts +162 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/legacydate.ts +17 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/math.ts +96 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/now.ts +48 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/plaindate.ts +212 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/plaindatetime.ts +274 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/plainmonthday.ts +110 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/plaintime.ts +154 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/plainyearmonth.ts +157 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/regex.ts +59 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/slots.ts +341 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/temporal.ts +10 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/timeduration.ts +149 -0
- package/runtime/node_modules/@js-temporal/polyfill/lib/zoneddatetime.ts +492 -0
- package/runtime/node_modules/@js-temporal/polyfill/package.json +143 -0
- package/runtime/node_modules/@oxc-parser/binding-linux-x64-gnu/README.md +3 -0
- package/runtime/node_modules/@oxc-parser/binding-linux-x64-gnu/package.json +42 -0
- package/runtime/node_modules/@oxc-parser/binding-linux-x64-gnu/parser.linux-x64-gnu.node +0 -0
- package/runtime/node_modules/@oxc-project/runtime/CHANGELOG.md +88 -0
- package/runtime/node_modules/@oxc-project/runtime/LICENSE +22 -0
- package/runtime/node_modules/@oxc-project/runtime/README.md +5 -0
- package/runtime/node_modules/@oxc-project/runtime/package.json +1066 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/AwaitValue.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/applyDecoratedDescriptor.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/applyDecs.js +236 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/applyDecs2203.js +184 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/applyDecs2203R.js +191 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/applyDecs2301.js +222 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/applyDecs2305.js +133 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/applyDecs2311.js +124 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/arrayLikeToArray.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/arrayWithHoles.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/arrayWithoutHoles.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/assertClassBrand.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/assertThisInitialized.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/asyncGeneratorDelegate.js +24 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js +45 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/asyncToGenerator.js +26 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/callSuper.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/checkInRHS.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/checkPrivateRedeclaration.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classApplyDescriptorDestructureSet.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classApplyDescriptorGet.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classApplyDescriptorSet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classCallCheck.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classCheckPrivateStaticAccess.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classCheckPrivateStaticFieldDescriptor.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classExtractFieldDescriptor.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classNameTDZError.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateFieldDestructureSet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateFieldGet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateFieldGet2.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateFieldInitSpec.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateFieldLooseBase.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateFieldLooseKey.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateFieldSet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateFieldSet2.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateGetter.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateMethodGet.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateMethodInitSpec.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateMethodSet.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateSetter.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classStaticPrivateFieldDestructureSet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classStaticPrivateFieldSpecGet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classStaticPrivateFieldSpecSet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classStaticPrivateMethodGet.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/classStaticPrivateMethodSet.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/construct.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/createClass.js +13 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/createForOfIteratorHelper.js +50 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/createForOfIteratorHelperLoose.js +19 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/createSuper.js +16 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/decorate.js +23 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/decorateMetadata.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/decorateParam.js +11 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/defaults.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/defineAccessor.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/defineEnumerableProperties.js +12 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/dispose.js +28 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/AwaitValue.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/OverloadYield.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/applyDecoratedDescriptor.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/applyDecs.js +236 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/applyDecs2203.js +184 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/applyDecs2203R.js +191 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/applyDecs2301.js +222 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/applyDecs2305.js +133 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/applyDecs2311.js +124 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/arrayLikeToArray.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/arrayWithHoles.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/arrayWithoutHoles.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/assertClassBrand.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/assertThisInitialized.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/asyncGeneratorDelegate.js +24 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/asyncIterator.js +45 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/asyncToGenerator.js +26 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/awaitAsyncGenerator.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/callSuper.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/checkInRHS.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/checkPrivateRedeclaration.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classApplyDescriptorDestructureSet.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classApplyDescriptorGet.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classApplyDescriptorSet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classCallCheck.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classCheckPrivateStaticAccess.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classCheckPrivateStaticFieldDescriptor.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classExtractFieldDescriptor.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classNameTDZError.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateFieldDestructureSet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateFieldGet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateFieldGet2.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateFieldInitSpec.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateFieldLooseBase.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateFieldLooseKey.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateFieldSet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateFieldSet2.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateGetter.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateMethodGet.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateMethodInitSpec.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateMethodSet.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateSetter.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classStaticPrivateFieldDestructureSet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classStaticPrivateFieldSpecGet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classStaticPrivateFieldSpecSet.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classStaticPrivateMethodGet.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classStaticPrivateMethodSet.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/construct.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/createClass.js +13 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/createForOfIteratorHelper.js +50 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/createForOfIteratorHelperLoose.js +19 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/createSuper.js +16 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/decorate.js +21 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/decorateMetadata.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/decorateParam.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/defaults.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/defineAccessor.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/defineEnumerableProperties.js +12 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/defineProperty.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/dispose.js +28 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/extends.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/get.js +11 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/getPrototypeOf.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/identity.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/importDeferProxy.js +27 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/inherits.js +14 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/inheritsLoose.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/initializerDefineProperty.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/initializerWarningHelper.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/instanceof.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/interopRequireDefault.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/interopRequireWildcard.js +27 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/isNativeFunction.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/isNativeReflectConstruct.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/iterableToArray.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/iterableToArrayLimit.js +28 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/jsx.js +22 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/maybeArrayLike.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/newArrowCheck.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/nonIterableRest.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/nonIterableSpread.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/nullishReceiverError.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/objectDestructuringEmpty.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/objectSpread.js +14 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/objectSpread2.js +23 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/objectWithoutProperties.js +13 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/objectWithoutPropertiesLoose.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/package.json +3 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/possibleConstructorReturn.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/readOnlyError.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/regeneratorRuntime.js +304 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/set.js +22 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/setFunctionName.js +12 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/setPrototypeOf.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/skipFirstGeneratorNext.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/slicedToArray.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/superPropBase.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/superPropGet.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/superPropSet.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/taggedTemplateLiteral.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/taggedTemplateLiteralLoose.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/tdz.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/temporalRef.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/temporalUndefined.js +2 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/toArray.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/toConsumableArray.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/toPrimitive.js +12 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/toPropertyKey.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/toSetter.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/typeof.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/unsupportedIterableToArray.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/using.js +12 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/usingCtx.js +59 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/wrapAsyncGenerator.js +69 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/wrapNativeSuper.js +27 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/wrapRegExp.js +51 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/writeOnlyError.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/extends.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/get.js +11 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/getPrototypeOf.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/identity.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/importDeferProxy.js +27 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/inherits.js +14 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/inheritsLoose.js +5 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/initializerDefineProperty.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/initializerWarningHelper.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/instanceof.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/interopRequireDefault.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/interopRequireWildcard.js +27 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/isNativeFunction.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/isNativeReflectConstruct.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/iterableToArray.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/iterableToArrayLimit.js +28 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/jsx.js +22 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/maybeArrayLike.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/newArrowCheck.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/nonIterableRest.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/nonIterableSpread.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/nullishReceiverError.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/objectDestructuringEmpty.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/objectSpread.js +14 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js +23 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/objectWithoutProperties.js +13 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/objectWithoutPropertiesLoose.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/possibleConstructorReturn.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/readOnlyError.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/regeneratorRuntime.js +304 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/set.js +22 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/setFunctionName.js +12 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/setPrototypeOf.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/skipFirstGeneratorNext.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/slicedToArray.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/superPropBase.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/superPropGet.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/superPropSet.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/taggedTemplateLiteral.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/taggedTemplateLiteralLoose.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/tdz.js +4 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/temporalRef.js +6 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/temporalUndefined.js +2 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/toArray.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/toConsumableArray.js +8 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js +12 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js +7 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/toSetter.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/typeof.js +10 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/unsupportedIterableToArray.js +9 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/using.js +12 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js +59 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js +69 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/wrapNativeSuper.js +27 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/wrapRegExp.js +51 -0
- package/runtime/node_modules/@oxc-project/runtime/src/helpers/writeOnlyError.js +4 -0
- package/runtime/node_modules/@oxc-project/types/LICENSE +22 -0
- package/runtime/node_modules/@oxc-project/types/README.md +3 -0
- package/runtime/node_modules/@oxc-project/types/package.json +26 -0
- package/runtime/node_modules/@oxc-project/types/types.d.ts +1912 -0
- package/runtime/node_modules/@petamoriken/float16/LICENSE +21 -0
- package/runtime/node_modules/@petamoriken/float16/README.md +413 -0
- package/runtime/node_modules/@petamoriken/float16/browser/float16.js +1340 -0
- package/runtime/node_modules/@petamoriken/float16/browser/float16.mjs +1325 -0
- package/runtime/node_modules/@petamoriken/float16/index.d.ts +546 -0
- package/runtime/node_modules/@petamoriken/float16/index.v5.6.d.ts +546 -0
- package/runtime/node_modules/@petamoriken/float16/index.v5.7.d.ts +555 -0
- package/runtime/node_modules/@petamoriken/float16/inspect/node.cjs +25 -0
- package/runtime/node_modules/@petamoriken/float16/inspect/node.mjs +23 -0
- package/runtime/node_modules/@petamoriken/float16/lib/DataView.cjs +16 -0
- package/runtime/node_modules/@petamoriken/float16/lib/Float16Array.cjs +690 -0
- package/runtime/node_modules/@petamoriken/float16/lib/_util/arrayIterator.cjs +52 -0
- package/runtime/node_modules/@petamoriken/float16/lib/_util/brand.cjs +27 -0
- package/runtime/node_modules/@petamoriken/float16/lib/_util/converter.cjs +111 -0
- package/runtime/node_modules/@petamoriken/float16/lib/_util/is.cjs +78 -0
- package/runtime/node_modules/@petamoriken/float16/lib/_util/messages.cjs +18 -0
- package/runtime/node_modules/@petamoriken/float16/lib/_util/primordials.cjs +150 -0
- package/runtime/node_modules/@petamoriken/float16/lib/_util/spec.cjs +84 -0
- package/runtime/node_modules/@petamoriken/float16/lib/f16round.cjs +10 -0
- package/runtime/node_modules/@petamoriken/float16/lib/index.cjs +16 -0
- package/runtime/node_modules/@petamoriken/float16/lib/isTypedArray.cjs +11 -0
- package/runtime/node_modules/@petamoriken/float16/package.json +115 -0
- package/runtime/node_modules/@petamoriken/float16/src/DataView.mjs +35 -0
- package/runtime/node_modules/@petamoriken/float16/src/Float16Array.mjs +1194 -0
- package/runtime/node_modules/@petamoriken/float16/src/_util/arrayIterator.mjs +86 -0
- package/runtime/node_modules/@petamoriken/float16/src/_util/brand.mjs +31 -0
- package/runtime/node_modules/@petamoriken/float16/src/_util/converter.mjs +173 -0
- package/runtime/node_modules/@petamoriken/float16/src/_util/is.mjs +151 -0
- package/runtime/node_modules/@petamoriken/float16/src/_util/messages.mjs +22 -0
- package/runtime/node_modules/@petamoriken/float16/src/_util/primordials.mjs +254 -0
- package/runtime/node_modules/@petamoriken/float16/src/_util/spec.mjs +137 -0
- package/runtime/node_modules/@petamoriken/float16/src/f16round.mjs +10 -0
- package/runtime/node_modules/@petamoriken/float16/src/index.mjs +7 -0
- package/runtime/node_modules/@petamoriken/float16/src/isTypedArray.mjs +10 -0
- package/runtime/node_modules/jsbi/LICENSE +176 -0
- package/runtime/node_modules/jsbi/README.md +173 -0
- package/runtime/node_modules/jsbi/dist/jsbi-cjs.js +2 -0
- package/runtime/node_modules/jsbi/dist/jsbi-cjs.js.map +1 -0
- package/runtime/node_modules/jsbi/dist/jsbi-umd.js +2 -0
- package/runtime/node_modules/jsbi/dist/jsbi-umd.js.map +1 -0
- package/runtime/node_modules/jsbi/dist/jsbi.mjs +2 -0
- package/runtime/node_modules/jsbi/dist/jsbi.mjs.map +1 -0
- package/runtime/node_modules/jsbi/jsbi.d.ts +43 -0
- package/runtime/node_modules/jsbi/package.json +35 -0
- package/runtime/node_modules/oxc-parser/LICENSE +22 -0
- package/runtime/node_modules/oxc-parser/README.md +167 -0
- package/runtime/node_modules/oxc-parser/package.json +153 -0
- package/runtime/node_modules/oxc-parser/src-js/bindings.js +601 -0
- package/runtime/node_modules/oxc-parser/src-js/generated/constants.js +105 -0
- package/runtime/node_modules/oxc-parser/src-js/generated/deserialize/js.js +5862 -0
- package/runtime/node_modules/oxc-parser/src-js/generated/deserialize/js_range.js +6403 -0
- package/runtime/node_modules/oxc-parser/src-js/generated/deserialize/ts.js +6154 -0
- package/runtime/node_modules/oxc-parser/src-js/generated/deserialize/ts_range.js +6723 -0
- package/runtime/node_modules/oxc-parser/src-js/generated/lazy/constructors.js +13875 -0
- package/runtime/node_modules/oxc-parser/src-js/generated/lazy/type_ids.js +191 -0
- package/runtime/node_modules/oxc-parser/src-js/generated/lazy/walk.js +5810 -0
- package/runtime/node_modules/oxc-parser/src-js/generated/visit/keys.js +220 -0
- package/runtime/node_modules/oxc-parser/src-js/generated/visit/type_ids.js +177 -0
- package/runtime/node_modules/oxc-parser/src-js/generated/visit/visitor.d.ts +387 -0
- package/runtime/node_modules/oxc-parser/src-js/generated/visit/walk.js +2455 -0
- package/runtime/node_modules/oxc-parser/src-js/index.d.ts +312 -0
- package/runtime/node_modules/oxc-parser/src-js/index.js +108 -0
- package/runtime/node_modules/oxc-parser/src-js/raw-transfer/common.js +301 -0
- package/runtime/node_modules/oxc-parser/src-js/raw-transfer/eager.js +255 -0
- package/runtime/node_modules/oxc-parser/src-js/raw-transfer/lazy-common.js +11 -0
- package/runtime/node_modules/oxc-parser/src-js/raw-transfer/lazy.js +162 -0
- package/runtime/node_modules/oxc-parser/src-js/raw-transfer/node-array.js +365 -0
- package/runtime/node_modules/oxc-parser/src-js/raw-transfer/supported.js +52 -0
- package/runtime/node_modules/oxc-parser/src-js/raw-transfer/visitor.js +127 -0
- package/runtime/node_modules/oxc-parser/src-js/visit/index.js +41 -0
- package/runtime/node_modules/oxc-parser/src-js/visit/visitor.js +405 -0
- package/runtime/node_modules/oxc-parser/src-js/wasm.js +13 -0
- package/runtime/node_modules/oxc-parser/src-js/webcontainer-fallback.cjs +21 -0
- package/runtime/node_modules/oxc-parser/src-js/wrap.js +57 -0
- package/runtime/node_modules/urlpattern-polyfill/LICENSE +19 -0
- package/runtime/node_modules/urlpattern-polyfill/README.md +242 -0
- package/runtime/node_modules/urlpattern-polyfill/dist/index.d.ts +9 -0
- package/runtime/node_modules/urlpattern-polyfill/dist/types.d.ts +49 -0
- package/runtime/node_modules/urlpattern-polyfill/dist/urlpattern.cjs +1 -0
- package/runtime/node_modules/urlpattern-polyfill/dist/urlpattern.js +1 -0
- package/runtime/node_modules/urlpattern-polyfill/index.cjs +7 -0
- package/runtime/node_modules/urlpattern-polyfill/index.js +7 -0
- package/runtime/node_modules/urlpattern-polyfill/package.json +149 -0
- package/runtime/polyfills.mjs +73 -97
- package/runtime/preload-async-hooks.mjs +50 -0
- package/runtime/preload.mjs +274 -320
- package/runtime/transform-core.mjs +762 -0
- package/runtime/version.mjs +12 -0
- package/runtime/worker-polyfill.mjs +147 -9
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import JSBI from 'jsbi';
|
|
2
|
+
|
|
3
|
+
import { assert } from './assert';
|
|
4
|
+
import {
|
|
5
|
+
abs,
|
|
6
|
+
BILLION,
|
|
7
|
+
compare,
|
|
8
|
+
DAY_NANOS_JSBI,
|
|
9
|
+
divmod,
|
|
10
|
+
ensureJSBI,
|
|
11
|
+
HOUR_NANOS,
|
|
12
|
+
isEven,
|
|
13
|
+
MILLION,
|
|
14
|
+
MINUTE_NANOS_JSBI,
|
|
15
|
+
ONE,
|
|
16
|
+
TEN,
|
|
17
|
+
THOUSAND,
|
|
18
|
+
TWO,
|
|
19
|
+
ZERO
|
|
20
|
+
} from './bigintmath';
|
|
21
|
+
import { ApplyUnsignedRoundingMode, GetUnsignedRoundingMode } from './math';
|
|
22
|
+
import type { Temporal } from '..';
|
|
23
|
+
|
|
24
|
+
export class TimeDuration {
|
|
25
|
+
static MAX = JSBI.BigInt('9007199254740991999999999');
|
|
26
|
+
static ZERO = new TimeDuration(ZERO);
|
|
27
|
+
|
|
28
|
+
totalNs: JSBI;
|
|
29
|
+
sec: number;
|
|
30
|
+
subsec: number;
|
|
31
|
+
|
|
32
|
+
constructor(totalNs: bigint | JSBI) {
|
|
33
|
+
assert(typeof totalNs !== 'number', 'big integer required');
|
|
34
|
+
this.totalNs = ensureJSBI(totalNs);
|
|
35
|
+
assert(JSBI.lessThanOrEqual(abs(this.totalNs), TimeDuration.MAX), 'integer too big');
|
|
36
|
+
|
|
37
|
+
this.sec = JSBI.toNumber(JSBI.divide(this.totalNs, BILLION));
|
|
38
|
+
this.subsec = JSBI.toNumber(JSBI.remainder(this.totalNs, BILLION));
|
|
39
|
+
assert(Number.isSafeInteger(this.sec), 'seconds too big');
|
|
40
|
+
assert(Math.abs(this.subsec) <= 999_999_999, 'subseconds too big');
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
static validateNew(totalNs: JSBI, operation: string) {
|
|
44
|
+
if (JSBI.greaterThan(abs(totalNs), TimeDuration.MAX)) {
|
|
45
|
+
throw new RangeError(`${operation} of duration time units cannot exceed ${TimeDuration.MAX} s`);
|
|
46
|
+
}
|
|
47
|
+
return new TimeDuration(totalNs);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
static fromEpochNsDiff(epochNs1: JSBI | bigint, epochNs2: JSBI | bigint) {
|
|
51
|
+
const diff = JSBI.subtract(ensureJSBI(epochNs1), ensureJSBI(epochNs2));
|
|
52
|
+
// No extra validate step. Should instead fail assertion if too big
|
|
53
|
+
return new TimeDuration(diff);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
static fromComponents(h: number, min: number, s: number, ms: number, µs: number, ns: number) {
|
|
57
|
+
const totalNs = JSBI.add(
|
|
58
|
+
JSBI.add(
|
|
59
|
+
JSBI.add(
|
|
60
|
+
JSBI.add(
|
|
61
|
+
JSBI.add(JSBI.BigInt(ns), JSBI.multiply(JSBI.BigInt(µs), THOUSAND)),
|
|
62
|
+
JSBI.multiply(JSBI.BigInt(ms), MILLION)
|
|
63
|
+
),
|
|
64
|
+
JSBI.multiply(JSBI.BigInt(s), BILLION)
|
|
65
|
+
),
|
|
66
|
+
JSBI.multiply(JSBI.BigInt(min), MINUTE_NANOS_JSBI)
|
|
67
|
+
),
|
|
68
|
+
JSBI.multiply(JSBI.BigInt(h), HOUR_NANOS)
|
|
69
|
+
);
|
|
70
|
+
return TimeDuration.validateNew(totalNs, 'total');
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
abs() {
|
|
74
|
+
return new TimeDuration(abs(this.totalNs));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
add(other: TimeDuration) {
|
|
78
|
+
return TimeDuration.validateNew(JSBI.add(this.totalNs, other.totalNs), 'sum');
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
add24HourDays(days: number) {
|
|
82
|
+
assert(Number.isInteger(days), 'days must be an integer');
|
|
83
|
+
return TimeDuration.validateNew(JSBI.add(this.totalNs, JSBI.multiply(JSBI.BigInt(days), DAY_NANOS_JSBI)), 'sum');
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
addToEpochNs(epochNs: JSBI | bigint) {
|
|
87
|
+
return JSBI.add(ensureJSBI(epochNs), this.totalNs);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
cmp(other: TimeDuration) {
|
|
91
|
+
return compare(this.totalNs, other.totalNs);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
divmod(n: number) {
|
|
95
|
+
assert(n !== 0, 'division by zero');
|
|
96
|
+
const { quotient, remainder } = divmod(this.totalNs, JSBI.BigInt(n));
|
|
97
|
+
const q = JSBI.toNumber(quotient);
|
|
98
|
+
const r = new TimeDuration(remainder);
|
|
99
|
+
return { quotient: q, remainder: r };
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
fdiv(nParam: JSBI | bigint) {
|
|
103
|
+
const n = ensureJSBI(nParam);
|
|
104
|
+
assert(!JSBI.equal(n, ZERO), 'division by zero');
|
|
105
|
+
const nBigInt = JSBI.BigInt(n);
|
|
106
|
+
let { quotient, remainder } = divmod(this.totalNs, nBigInt);
|
|
107
|
+
|
|
108
|
+
// Perform long division to calculate the fractional part of the quotient
|
|
109
|
+
// remainder / n with more accuracy than 64-bit floating point division
|
|
110
|
+
const precision = 50;
|
|
111
|
+
const decimalDigits: number[] = [];
|
|
112
|
+
let digit;
|
|
113
|
+
const sign = (JSBI.lessThan(this.totalNs, ZERO) ? -1 : 1) * Math.sign(JSBI.toNumber(n));
|
|
114
|
+
while (!JSBI.equal(remainder, ZERO) && decimalDigits.length < precision) {
|
|
115
|
+
remainder = JSBI.multiply(remainder, TEN);
|
|
116
|
+
({ quotient: digit, remainder } = divmod(remainder, nBigInt));
|
|
117
|
+
decimalDigits.push(Math.abs(JSBI.toNumber(digit)));
|
|
118
|
+
}
|
|
119
|
+
return sign * Number(abs(quotient).toString() + '.' + decimalDigits.join(''));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
isZero() {
|
|
123
|
+
return JSBI.equal(this.totalNs, ZERO);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
round(incrementParam: JSBI | bigint, mode: Temporal.RoundingMode) {
|
|
127
|
+
const increment = ensureJSBI(incrementParam);
|
|
128
|
+
if (JSBI.equal(increment, ONE)) return this;
|
|
129
|
+
const { quotient, remainder } = divmod(this.totalNs, increment);
|
|
130
|
+
const sign = JSBI.lessThan(this.totalNs, ZERO) ? 'negative' : 'positive';
|
|
131
|
+
const r1 = JSBI.multiply(abs(quotient), increment);
|
|
132
|
+
const r2 = JSBI.add(r1, increment);
|
|
133
|
+
const cmp = compare(abs(JSBI.multiply(remainder, TWO)), increment);
|
|
134
|
+
const unsignedRoundingMode = GetUnsignedRoundingMode(mode, sign);
|
|
135
|
+
const rounded = JSBI.equal(abs(this.totalNs), r1)
|
|
136
|
+
? r1
|
|
137
|
+
: ApplyUnsignedRoundingMode(r1, r2, cmp, isEven(quotient), unsignedRoundingMode);
|
|
138
|
+
const result = sign === 'positive' ? rounded : JSBI.unaryMinus(rounded);
|
|
139
|
+
return TimeDuration.validateNew(result, 'rounding');
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
sign() {
|
|
143
|
+
return this.cmp(new TimeDuration(ZERO));
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
subtract(other: TimeDuration) {
|
|
147
|
+
return TimeDuration.validateNew(JSBI.subtract(this.totalNs, other.totalNs), 'difference');
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -0,0 +1,492 @@
|
|
|
1
|
+
import { assert } from './assert';
|
|
2
|
+
import * as ES from './ecmascript';
|
|
3
|
+
import { MakeIntrinsicClass } from './intrinsicclass';
|
|
4
|
+
import { CALENDAR, EPOCHNANOSECONDS, TIME, TIME_ZONE, GetSlot } from './slots';
|
|
5
|
+
import { TimeDuration } from './timeduration';
|
|
6
|
+
import type { Temporal } from '..';
|
|
7
|
+
import { DateTimeFormat } from './intl';
|
|
8
|
+
import type {
|
|
9
|
+
BuiltinCalendarId,
|
|
10
|
+
CalendarDateRecord,
|
|
11
|
+
ZonedDateTimeParams as Params,
|
|
12
|
+
ZonedDateTimeReturn as Return
|
|
13
|
+
} from './internaltypes';
|
|
14
|
+
|
|
15
|
+
import JSBI from 'jsbi';
|
|
16
|
+
|
|
17
|
+
const customResolvedOptions = DateTimeFormat.prototype.resolvedOptions as Intl.DateTimeFormat['resolvedOptions'];
|
|
18
|
+
|
|
19
|
+
export class ZonedDateTime implements Temporal.ZonedDateTime {
|
|
20
|
+
constructor(epochNanosecondsParam: bigint | JSBI, timeZoneParam: string, calendarParam = 'iso8601') {
|
|
21
|
+
// Note: if the argument is not passed, ToBigInt(undefined) will throw. This check exists only
|
|
22
|
+
// to improve the error message.
|
|
23
|
+
if (arguments.length < 1) {
|
|
24
|
+
throw new TypeError('missing argument: epochNanoseconds is required');
|
|
25
|
+
}
|
|
26
|
+
const epochNanoseconds = ES.ToBigInt(epochNanosecondsParam);
|
|
27
|
+
let timeZone = ES.RequireString(timeZoneParam);
|
|
28
|
+
const { tzName, offsetMinutes } = ES.ParseTimeZoneIdentifier(timeZone);
|
|
29
|
+
if (offsetMinutes === undefined) {
|
|
30
|
+
// if offsetMinutes is undefined, then tzName must be present
|
|
31
|
+
const record = ES.GetAvailableNamedTimeZoneIdentifier(tzName);
|
|
32
|
+
if (!record) throw new RangeError(`unknown time zone ${tzName}`);
|
|
33
|
+
timeZone = record.identifier;
|
|
34
|
+
} else {
|
|
35
|
+
timeZone = ES.FormatOffsetTimeZoneIdentifier(offsetMinutes);
|
|
36
|
+
}
|
|
37
|
+
const calendar = ES.CanonicalizeCalendar(calendarParam === undefined ? 'iso8601' : ES.RequireString(calendarParam));
|
|
38
|
+
|
|
39
|
+
ES.CreateTemporalZonedDateTimeSlots(this, epochNanoseconds, timeZone, calendar);
|
|
40
|
+
}
|
|
41
|
+
get calendarId(): Return['calendarId'] {
|
|
42
|
+
ES.CheckReceiver(this, ES.IsTemporalZonedDateTime);
|
|
43
|
+
return GetSlot(this, CALENDAR);
|
|
44
|
+
}
|
|
45
|
+
get timeZoneId(): Return['timeZoneId'] {
|
|
46
|
+
ES.CheckReceiver(this, ES.IsTemporalZonedDateTime);
|
|
47
|
+
return GetSlot(this, TIME_ZONE);
|
|
48
|
+
}
|
|
49
|
+
get year(): Return['year'] {
|
|
50
|
+
return getCalendarProperty(this, 'year');
|
|
51
|
+
}
|
|
52
|
+
get month(): Return['month'] {
|
|
53
|
+
return getCalendarProperty(this, 'month');
|
|
54
|
+
}
|
|
55
|
+
get monthCode(): Return['monthCode'] {
|
|
56
|
+
return getCalendarProperty(this, 'monthCode');
|
|
57
|
+
}
|
|
58
|
+
get day(): Return['day'] {
|
|
59
|
+
return getCalendarProperty(this, 'day');
|
|
60
|
+
}
|
|
61
|
+
get hour(): Return['hour'] {
|
|
62
|
+
return getTimeProperty(this, 'hour');
|
|
63
|
+
}
|
|
64
|
+
get minute(): Return['minute'] {
|
|
65
|
+
return getTimeProperty(this, 'minute');
|
|
66
|
+
}
|
|
67
|
+
get second(): Return['second'] {
|
|
68
|
+
return getTimeProperty(this, 'second');
|
|
69
|
+
}
|
|
70
|
+
get millisecond(): Return['millisecond'] {
|
|
71
|
+
return getTimeProperty(this, 'millisecond');
|
|
72
|
+
}
|
|
73
|
+
get microsecond(): Return['microsecond'] {
|
|
74
|
+
return getTimeProperty(this, 'microsecond');
|
|
75
|
+
}
|
|
76
|
+
get nanosecond(): Return['nanosecond'] {
|
|
77
|
+
return getTimeProperty(this, 'nanosecond');
|
|
78
|
+
}
|
|
79
|
+
get era(): Return['era'] {
|
|
80
|
+
return getCalendarProperty(this, 'era');
|
|
81
|
+
}
|
|
82
|
+
get eraYear(): Return['eraYear'] {
|
|
83
|
+
return getCalendarProperty(this, 'eraYear');
|
|
84
|
+
}
|
|
85
|
+
get epochMilliseconds(): Return['epochMilliseconds'] {
|
|
86
|
+
ES.CheckReceiver(this, ES.IsTemporalZonedDateTime);
|
|
87
|
+
const value = GetSlot(this, EPOCHNANOSECONDS);
|
|
88
|
+
return ES.epochNsToMs(value, 'floor');
|
|
89
|
+
}
|
|
90
|
+
get epochNanoseconds(): Return['epochNanoseconds'] {
|
|
91
|
+
ES.CheckReceiver(this, ES.IsTemporalZonedDateTime);
|
|
92
|
+
return ES.ToBigIntExternal(GetSlot(this, EPOCHNANOSECONDS));
|
|
93
|
+
}
|
|
94
|
+
get dayOfWeek(): Return['dayOfWeek'] {
|
|
95
|
+
return getCalendarProperty(this, 'dayOfWeek');
|
|
96
|
+
}
|
|
97
|
+
get dayOfYear(): Return['dayOfYear'] {
|
|
98
|
+
return getCalendarProperty(this, 'dayOfYear');
|
|
99
|
+
}
|
|
100
|
+
get weekOfYear(): Return['weekOfYear'] {
|
|
101
|
+
return getCalendarProperty(this, 'weekOfYear')?.week;
|
|
102
|
+
}
|
|
103
|
+
get yearOfWeek(): Return['yearOfWeek'] {
|
|
104
|
+
return getCalendarProperty(this, 'weekOfYear')?.year;
|
|
105
|
+
}
|
|
106
|
+
get hoursInDay(): Return['hoursInDay'] {
|
|
107
|
+
ES.CheckReceiver(this, ES.IsTemporalZonedDateTime);
|
|
108
|
+
const timeZone = GetSlot(this, TIME_ZONE);
|
|
109
|
+
const today = dateTime(this).isoDate;
|
|
110
|
+
const tomorrow = ES.BalanceISODate(today.year, today.month, today.day + 1);
|
|
111
|
+
const todayNs = ES.GetStartOfDay(timeZone, today);
|
|
112
|
+
const tomorrowNs = ES.GetStartOfDay(timeZone, tomorrow);
|
|
113
|
+
const diff = TimeDuration.fromEpochNsDiff(tomorrowNs, todayNs);
|
|
114
|
+
return ES.TotalTimeDuration(diff, 'hour');
|
|
115
|
+
}
|
|
116
|
+
get daysInWeek(): Return['daysInWeek'] {
|
|
117
|
+
return getCalendarProperty(this, 'daysInWeek');
|
|
118
|
+
}
|
|
119
|
+
get daysInMonth(): Return['daysInMonth'] {
|
|
120
|
+
return getCalendarProperty(this, 'daysInMonth');
|
|
121
|
+
}
|
|
122
|
+
get daysInYear(): Return['daysInYear'] {
|
|
123
|
+
return getCalendarProperty(this, 'daysInYear');
|
|
124
|
+
}
|
|
125
|
+
get monthsInYear(): Return['monthsInYear'] {
|
|
126
|
+
return getCalendarProperty(this, 'monthsInYear');
|
|
127
|
+
}
|
|
128
|
+
get inLeapYear(): Return['inLeapYear'] {
|
|
129
|
+
return getCalendarProperty(this, 'inLeapYear');
|
|
130
|
+
}
|
|
131
|
+
get offset(): Return['offset'] {
|
|
132
|
+
ES.CheckReceiver(this, ES.IsTemporalZonedDateTime);
|
|
133
|
+
const offsetNs = ES.GetOffsetNanosecondsFor(GetSlot(this, TIME_ZONE), GetSlot(this, EPOCHNANOSECONDS));
|
|
134
|
+
return ES.FormatUTCOffsetNanoseconds(offsetNs);
|
|
135
|
+
}
|
|
136
|
+
get offsetNanoseconds(): Return['offsetNanoseconds'] {
|
|
137
|
+
ES.CheckReceiver(this, ES.IsTemporalZonedDateTime);
|
|
138
|
+
return ES.GetOffsetNanosecondsFor(GetSlot(this, TIME_ZONE), GetSlot(this, EPOCHNANOSECONDS));
|
|
139
|
+
}
|
|
140
|
+
with(temporalZonedDateTimeLike: Params['with'][0], options: Params['with'][1] = undefined): Return['with'] {
|
|
141
|
+
ES.CheckReceiver(this, ES.IsTemporalZonedDateTime);
|
|
142
|
+
if (!ES.IsObject(temporalZonedDateTimeLike)) {
|
|
143
|
+
throw new TypeError('invalid zoned-date-time-like');
|
|
144
|
+
}
|
|
145
|
+
ES.RejectTemporalLikeObject(temporalZonedDateTimeLike);
|
|
146
|
+
|
|
147
|
+
const calendar = GetSlot(this, CALENDAR);
|
|
148
|
+
const timeZone = GetSlot(this, TIME_ZONE);
|
|
149
|
+
const epochNs = GetSlot(this, EPOCHNANOSECONDS);
|
|
150
|
+
const offsetNs = ES.GetOffsetNanosecondsFor(timeZone, epochNs);
|
|
151
|
+
const isoDateTime = dateTime(this);
|
|
152
|
+
let fields = {
|
|
153
|
+
...ES.ISODateToFields(calendar, isoDateTime.isoDate),
|
|
154
|
+
...isoDateTime.time,
|
|
155
|
+
offset: ES.FormatUTCOffsetNanoseconds(offsetNs)
|
|
156
|
+
};
|
|
157
|
+
const partialZonedDateTime = ES.PrepareCalendarFields(
|
|
158
|
+
calendar,
|
|
159
|
+
temporalZonedDateTimeLike,
|
|
160
|
+
['year', 'month', 'monthCode', 'day'],
|
|
161
|
+
['hour', 'minute', 'second', 'millisecond', 'microsecond', 'nanosecond', 'offset'],
|
|
162
|
+
'partial'
|
|
163
|
+
);
|
|
164
|
+
fields = ES.CalendarMergeFields(calendar, fields, partialZonedDateTime);
|
|
165
|
+
|
|
166
|
+
const resolvedOptions = ES.GetOptionsObject(options);
|
|
167
|
+
const disambiguation = ES.GetTemporalDisambiguationOption(resolvedOptions);
|
|
168
|
+
const offset = ES.GetTemporalOffsetOption(resolvedOptions, 'prefer');
|
|
169
|
+
const overflow = ES.GetTemporalOverflowOption(resolvedOptions);
|
|
170
|
+
|
|
171
|
+
const newDateTime = ES.InterpretTemporalDateTimeFields(calendar, fields, overflow);
|
|
172
|
+
const newOffsetNs = ES.ParseDateTimeUTCOffset(fields.offset);
|
|
173
|
+
const epochNanoseconds = ES.InterpretISODateTimeOffset(
|
|
174
|
+
newDateTime.isoDate,
|
|
175
|
+
newDateTime.time,
|
|
176
|
+
'option',
|
|
177
|
+
newOffsetNs,
|
|
178
|
+
timeZone,
|
|
179
|
+
disambiguation,
|
|
180
|
+
offset,
|
|
181
|
+
/* matchMinute = */ false
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
return ES.CreateTemporalZonedDateTime(epochNanoseconds, timeZone, calendar);
|
|
185
|
+
}
|
|
186
|
+
withPlainTime(temporalTimeParam: Params['withPlainTime'][0] = undefined): Return['withPlainTime'] {
|
|
187
|
+
ES.CheckReceiver(this, ES.IsTemporalZonedDateTime);
|
|
188
|
+
|
|
189
|
+
const timeZone = GetSlot(this, TIME_ZONE);
|
|
190
|
+
const calendar = GetSlot(this, CALENDAR);
|
|
191
|
+
const iso = dateTime(this).isoDate;
|
|
192
|
+
|
|
193
|
+
let epochNs;
|
|
194
|
+
if (temporalTimeParam === undefined) {
|
|
195
|
+
epochNs = ES.GetStartOfDay(timeZone, iso);
|
|
196
|
+
} else {
|
|
197
|
+
const temporalTime = ES.ToTemporalTime(temporalTimeParam);
|
|
198
|
+
const dt = ES.CombineISODateAndTimeRecord(iso, GetSlot(temporalTime, TIME));
|
|
199
|
+
epochNs = ES.GetEpochNanosecondsFor(timeZone, dt, 'compatible');
|
|
200
|
+
}
|
|
201
|
+
return ES.CreateTemporalZonedDateTime(epochNs, timeZone, calendar);
|
|
202
|
+
}
|
|
203
|
+
withTimeZone(timeZoneParam: Params['withTimeZone'][0]): Return['withTimeZone'] {
|
|
204
|
+
ES.CheckReceiver(this, ES.IsTemporalZonedDateTime);
|
|
205
|
+
const timeZone = ES.ToTemporalTimeZoneIdentifier(timeZoneParam);
|
|
206
|
+
return ES.CreateTemporalZonedDateTime(GetSlot(this, EPOCHNANOSECONDS), timeZone, GetSlot(this, CALENDAR));
|
|
207
|
+
}
|
|
208
|
+
withCalendar(calendarParam: Params['withCalendar'][0]): Return['withCalendar'] {
|
|
209
|
+
ES.CheckReceiver(this, ES.IsTemporalZonedDateTime);
|
|
210
|
+
const calendar = ES.ToTemporalCalendarIdentifier(calendarParam);
|
|
211
|
+
return ES.CreateTemporalZonedDateTime(GetSlot(this, EPOCHNANOSECONDS), GetSlot(this, TIME_ZONE), calendar);
|
|
212
|
+
}
|
|
213
|
+
add(temporalDurationLike: Params['add'][0], options: Params['add'][1] = undefined): Return['add'] {
|
|
214
|
+
ES.CheckReceiver(this, ES.IsTemporalZonedDateTime);
|
|
215
|
+
return ES.AddDurationToZonedDateTime('add', this, temporalDurationLike, options);
|
|
216
|
+
}
|
|
217
|
+
subtract(
|
|
218
|
+
temporalDurationLike: Params['subtract'][0],
|
|
219
|
+
options: Params['subtract'][1] = undefined
|
|
220
|
+
): Return['subtract'] {
|
|
221
|
+
ES.CheckReceiver(this, ES.IsTemporalZonedDateTime);
|
|
222
|
+
return ES.AddDurationToZonedDateTime('subtract', this, temporalDurationLike, options);
|
|
223
|
+
}
|
|
224
|
+
until(other: Params['until'][0], options: Params['until'][1] = undefined): Return['until'] {
|
|
225
|
+
ES.CheckReceiver(this, ES.IsTemporalZonedDateTime);
|
|
226
|
+
return ES.DifferenceTemporalZonedDateTime('until', this, other, options);
|
|
227
|
+
}
|
|
228
|
+
since(other: Params['since'][0], options: Params['since'][1] = undefined): Return['since'] {
|
|
229
|
+
ES.CheckReceiver(this, ES.IsTemporalZonedDateTime);
|
|
230
|
+
return ES.DifferenceTemporalZonedDateTime('since', this, other, options);
|
|
231
|
+
}
|
|
232
|
+
round(roundToParam: Params['round'][0]): Return['round'] {
|
|
233
|
+
ES.CheckReceiver(this, ES.IsTemporalZonedDateTime);
|
|
234
|
+
if (roundToParam === undefined) throw new TypeError('options parameter is required');
|
|
235
|
+
const roundTo =
|
|
236
|
+
typeof roundToParam === 'string'
|
|
237
|
+
? (ES.CreateOnePropObject('smallestUnit', roundToParam) as Exclude<typeof roundToParam, string>)
|
|
238
|
+
: ES.GetOptionsObject(roundToParam);
|
|
239
|
+
const roundingIncrement = ES.GetTemporalRoundingIncrementOption(roundTo);
|
|
240
|
+
const roundingMode = ES.GetRoundingModeOption(roundTo, 'halfExpand');
|
|
241
|
+
const smallestUnit = ES.GetTemporalUnitValuedOption(roundTo, 'smallestUnit', 'time', ES.REQUIRED, ['day']);
|
|
242
|
+
const maximumIncrements = {
|
|
243
|
+
day: 1,
|
|
244
|
+
hour: 24,
|
|
245
|
+
minute: 60,
|
|
246
|
+
second: 60,
|
|
247
|
+
millisecond: 1000,
|
|
248
|
+
microsecond: 1000,
|
|
249
|
+
nanosecond: 1000
|
|
250
|
+
};
|
|
251
|
+
const maximum = maximumIncrements[smallestUnit];
|
|
252
|
+
const inclusive = maximum === 1;
|
|
253
|
+
ES.ValidateTemporalRoundingIncrement(roundingIncrement, maximum, inclusive);
|
|
254
|
+
|
|
255
|
+
if (smallestUnit === 'nanosecond' && roundingIncrement === 1) {
|
|
256
|
+
return ES.CreateTemporalZonedDateTime(
|
|
257
|
+
GetSlot(this, EPOCHNANOSECONDS),
|
|
258
|
+
GetSlot(this, TIME_ZONE),
|
|
259
|
+
GetSlot(this, CALENDAR)
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// first, round the underlying DateTime fields
|
|
264
|
+
const timeZone = GetSlot(this, TIME_ZONE);
|
|
265
|
+
const thisNs = GetSlot(this, EPOCHNANOSECONDS);
|
|
266
|
+
const iso = dateTime(this);
|
|
267
|
+
let epochNanoseconds;
|
|
268
|
+
|
|
269
|
+
if (smallestUnit === 'day') {
|
|
270
|
+
// Compute Instants for start-of-day and end-of-day
|
|
271
|
+
// Determine how far the current instant has progressed through this span.
|
|
272
|
+
const dateStart = iso.isoDate;
|
|
273
|
+
const dateEnd = ES.BalanceISODate(dateStart.year, dateStart.month, dateStart.day + 1);
|
|
274
|
+
|
|
275
|
+
const startNs = ES.GetStartOfDay(timeZone, dateStart);
|
|
276
|
+
assert(
|
|
277
|
+
JSBI.greaterThanOrEqual(thisNs, startNs),
|
|
278
|
+
'cannot produce an instant during a day that occurs before start-of-day instant'
|
|
279
|
+
);
|
|
280
|
+
|
|
281
|
+
const endNs = ES.GetStartOfDay(timeZone, dateEnd);
|
|
282
|
+
assert(
|
|
283
|
+
JSBI.lessThan(thisNs, endNs),
|
|
284
|
+
'cannot produce an instant during a day that occurs on or after end-of-day instant'
|
|
285
|
+
);
|
|
286
|
+
|
|
287
|
+
const dayLengthNs = JSBI.subtract(endNs, startNs);
|
|
288
|
+
const dayProgressNs = TimeDuration.fromEpochNsDiff(thisNs, startNs);
|
|
289
|
+
const roundedDayNs = dayProgressNs.round(dayLengthNs, roundingMode);
|
|
290
|
+
epochNanoseconds = roundedDayNs.addToEpochNs(startNs);
|
|
291
|
+
} else {
|
|
292
|
+
// smallestUnit < day
|
|
293
|
+
// Round based on ISO-calendar time units
|
|
294
|
+
const roundedDateTime = ES.RoundISODateTime(iso, roundingIncrement, smallestUnit, roundingMode);
|
|
295
|
+
|
|
296
|
+
// Now reset all DateTime fields but leave the TimeZone. The offset will
|
|
297
|
+
// also be retained if the new date/time values are still OK with the old
|
|
298
|
+
// offset. Otherwise the offset will be changed to be compatible with the
|
|
299
|
+
// new date/time values. If DST disambiguation is required, the `compatible`
|
|
300
|
+
// disambiguation algorithm will be used.
|
|
301
|
+
const offsetNs = ES.GetOffsetNanosecondsFor(timeZone, thisNs);
|
|
302
|
+
epochNanoseconds = ES.InterpretISODateTimeOffset(
|
|
303
|
+
roundedDateTime.isoDate,
|
|
304
|
+
roundedDateTime.time,
|
|
305
|
+
'option',
|
|
306
|
+
offsetNs,
|
|
307
|
+
timeZone,
|
|
308
|
+
'compatible',
|
|
309
|
+
'prefer',
|
|
310
|
+
/* matchMinute = */ false
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
return ES.CreateTemporalZonedDateTime(epochNanoseconds, timeZone, GetSlot(this, CALENDAR));
|
|
315
|
+
}
|
|
316
|
+
equals(otherParam: Params['equals'][0]): Return['equals'] {
|
|
317
|
+
ES.CheckReceiver(this, ES.IsTemporalZonedDateTime);
|
|
318
|
+
const other = ES.ToTemporalZonedDateTime(otherParam);
|
|
319
|
+
const one = GetSlot(this, EPOCHNANOSECONDS);
|
|
320
|
+
const two = GetSlot(other, EPOCHNANOSECONDS);
|
|
321
|
+
if (!JSBI.equal(JSBI.BigInt(one), JSBI.BigInt(two))) return false;
|
|
322
|
+
if (!ES.TimeZoneEquals(GetSlot(this, TIME_ZONE), GetSlot(other, TIME_ZONE))) return false;
|
|
323
|
+
return ES.CalendarEquals(GetSlot(this, CALENDAR), GetSlot(other, CALENDAR));
|
|
324
|
+
}
|
|
325
|
+
toString(options: Params['toString'][0] = undefined): string {
|
|
326
|
+
ES.CheckReceiver(this, ES.IsTemporalZonedDateTime);
|
|
327
|
+
const resolvedOptions = ES.GetOptionsObject(options);
|
|
328
|
+
const showCalendar = ES.GetTemporalShowCalendarNameOption(resolvedOptions);
|
|
329
|
+
const digits = ES.GetTemporalFractionalSecondDigitsOption(resolvedOptions);
|
|
330
|
+
const showOffset = ES.GetTemporalShowOffsetOption(resolvedOptions);
|
|
331
|
+
const roundingMode = ES.GetRoundingModeOption(resolvedOptions, 'trunc');
|
|
332
|
+
const smallestUnit = ES.GetTemporalUnitValuedOption(resolvedOptions, 'smallestUnit', 'time', undefined);
|
|
333
|
+
if (smallestUnit === 'hour') throw new RangeError('smallestUnit must be a time unit other than "hour"');
|
|
334
|
+
const showTimeZone = ES.GetTemporalShowTimeZoneNameOption(resolvedOptions);
|
|
335
|
+
const { precision, unit, increment } = ES.ToSecondsStringPrecisionRecord(smallestUnit, digits);
|
|
336
|
+
return ES.TemporalZonedDateTimeToString(this, precision, showCalendar, showTimeZone, showOffset, {
|
|
337
|
+
unit,
|
|
338
|
+
increment,
|
|
339
|
+
roundingMode
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
toLocaleString(
|
|
343
|
+
locales: Params['toLocaleString'][0] = undefined,
|
|
344
|
+
options: Params['toLocaleString'][1] = undefined
|
|
345
|
+
): string {
|
|
346
|
+
ES.CheckReceiver(this, ES.IsTemporalZonedDateTime);
|
|
347
|
+
const resolvedOptions = ES.GetOptionsObject(options);
|
|
348
|
+
|
|
349
|
+
// This is not quite per specification, but this polyfill's DateTimeFormat
|
|
350
|
+
// already doesn't match the InitializeDateTimeFormat operation, and the
|
|
351
|
+
// access order might change anyway;
|
|
352
|
+
// see https://github.com/tc39/ecma402/issues/747
|
|
353
|
+
const optionsCopy = Object.create(null);
|
|
354
|
+
ES.CopyDataProperties(optionsCopy, resolvedOptions, ['timeZone']);
|
|
355
|
+
|
|
356
|
+
if (resolvedOptions.timeZone !== undefined) {
|
|
357
|
+
throw new TypeError('ZonedDateTime toLocaleString does not accept a timeZone option');
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
if (
|
|
361
|
+
optionsCopy.year === undefined &&
|
|
362
|
+
optionsCopy.month === undefined &&
|
|
363
|
+
optionsCopy.day === undefined &&
|
|
364
|
+
optionsCopy.era === undefined &&
|
|
365
|
+
optionsCopy.weekday === undefined &&
|
|
366
|
+
optionsCopy.dateStyle === undefined &&
|
|
367
|
+
optionsCopy.hour === undefined &&
|
|
368
|
+
optionsCopy.minute === undefined &&
|
|
369
|
+
optionsCopy.second === undefined &&
|
|
370
|
+
optionsCopy.fractionalSecondDigits === undefined &&
|
|
371
|
+
optionsCopy.timeStyle === undefined &&
|
|
372
|
+
optionsCopy.dayPeriod === undefined &&
|
|
373
|
+
optionsCopy.timeZoneName === undefined
|
|
374
|
+
) {
|
|
375
|
+
optionsCopy.timeZoneName = 'short';
|
|
376
|
+
// The rest of the defaults will be filled in by formatting the Instant
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
optionsCopy.timeZone = GetSlot(this, TIME_ZONE);
|
|
380
|
+
if (ES.IsOffsetTimeZoneIdentifier(optionsCopy.timeZone)) {
|
|
381
|
+
// Note: https://github.com/tc39/ecma402/issues/683 will remove this
|
|
382
|
+
throw new RangeError('toLocaleString does not currently support offset time zones');
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
const formatter = new DateTimeFormat(locales, optionsCopy);
|
|
386
|
+
|
|
387
|
+
const localeCalendarIdentifier = customResolvedOptions.call(formatter).calendar as BuiltinCalendarId;
|
|
388
|
+
const calendarIdentifier = GetSlot(this, CALENDAR);
|
|
389
|
+
if (
|
|
390
|
+
calendarIdentifier !== 'iso8601' &&
|
|
391
|
+
localeCalendarIdentifier !== 'iso8601' &&
|
|
392
|
+
!ES.CalendarEquals(localeCalendarIdentifier, calendarIdentifier)
|
|
393
|
+
) {
|
|
394
|
+
throw new RangeError(
|
|
395
|
+
`cannot format ZonedDateTime with calendar ${calendarIdentifier}` +
|
|
396
|
+
` in locale with calendar ${localeCalendarIdentifier}`
|
|
397
|
+
);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
return formatter.format(ES.CreateTemporalInstant(GetSlot(this, EPOCHNANOSECONDS)));
|
|
401
|
+
}
|
|
402
|
+
toJSON(): Return['toJSON'] {
|
|
403
|
+
ES.CheckReceiver(this, ES.IsTemporalZonedDateTime);
|
|
404
|
+
return ES.TemporalZonedDateTimeToString(this, 'auto');
|
|
405
|
+
}
|
|
406
|
+
valueOf(): never {
|
|
407
|
+
ES.ValueOfThrows('ZonedDateTime');
|
|
408
|
+
}
|
|
409
|
+
startOfDay(): Return['startOfDay'] {
|
|
410
|
+
ES.CheckReceiver(this, ES.IsTemporalZonedDateTime);
|
|
411
|
+
const timeZone = GetSlot(this, TIME_ZONE);
|
|
412
|
+
const isoDate = dateTime(this).isoDate;
|
|
413
|
+
const epochNanoseconds = ES.GetStartOfDay(timeZone, isoDate);
|
|
414
|
+
return ES.CreateTemporalZonedDateTime(epochNanoseconds, timeZone, GetSlot(this, CALENDAR));
|
|
415
|
+
}
|
|
416
|
+
getTimeZoneTransition(directionParam: Params['getTimeZoneTransition'][0]): Return['getTimeZoneTransition'] {
|
|
417
|
+
ES.CheckReceiver(this, ES.IsTemporalZonedDateTime);
|
|
418
|
+
const timeZone = GetSlot(this, TIME_ZONE);
|
|
419
|
+
|
|
420
|
+
if (directionParam === undefined) throw new TypeError('options parameter is required');
|
|
421
|
+
const direction = ES.GetDirectionOption(
|
|
422
|
+
typeof directionParam === 'string'
|
|
423
|
+
? (ES.CreateOnePropObject('direction', directionParam) as Exclude<typeof directionParam, string>)
|
|
424
|
+
: ES.GetOptionsObject(directionParam)
|
|
425
|
+
);
|
|
426
|
+
if (direction === undefined) throw new TypeError('direction option is required');
|
|
427
|
+
|
|
428
|
+
// Offset time zones or UTC have no transitions
|
|
429
|
+
if (ES.IsOffsetTimeZoneIdentifier(timeZone) || timeZone === 'UTC') {
|
|
430
|
+
return null;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
const thisEpochNanoseconds = GetSlot(this, EPOCHNANOSECONDS);
|
|
434
|
+
const epochNanoseconds =
|
|
435
|
+
direction === 'next'
|
|
436
|
+
? ES.GetNamedTimeZoneNextTransition(timeZone, thisEpochNanoseconds)
|
|
437
|
+
: ES.GetNamedTimeZonePreviousTransition(timeZone, thisEpochNanoseconds);
|
|
438
|
+
return epochNanoseconds === null
|
|
439
|
+
? null
|
|
440
|
+
: ES.CreateTemporalZonedDateTime(epochNanoseconds, timeZone, GetSlot(this, CALENDAR));
|
|
441
|
+
}
|
|
442
|
+
toInstant(): Return['toInstant'] {
|
|
443
|
+
ES.CheckReceiver(this, ES.IsTemporalZonedDateTime);
|
|
444
|
+
return ES.CreateTemporalInstant(GetSlot(this, EPOCHNANOSECONDS));
|
|
445
|
+
}
|
|
446
|
+
toPlainDate(): Return['toPlainDate'] {
|
|
447
|
+
ES.CheckReceiver(this, ES.IsTemporalZonedDateTime);
|
|
448
|
+
return ES.CreateTemporalDate(dateTime(this).isoDate, GetSlot(this, CALENDAR));
|
|
449
|
+
}
|
|
450
|
+
toPlainTime(): Return['toPlainTime'] {
|
|
451
|
+
ES.CheckReceiver(this, ES.IsTemporalZonedDateTime);
|
|
452
|
+
return ES.CreateTemporalTime(dateTime(this).time);
|
|
453
|
+
}
|
|
454
|
+
toPlainDateTime(): Return['toPlainDateTime'] {
|
|
455
|
+
ES.CheckReceiver(this, ES.IsTemporalZonedDateTime);
|
|
456
|
+
return ES.CreateTemporalDateTime(dateTime(this), GetSlot(this, CALENDAR));
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
static from(item: Params['from'][0], optionsParam: Params['from'][1] = undefined): Return['from'] {
|
|
460
|
+
return ES.ToTemporalZonedDateTime(item, optionsParam);
|
|
461
|
+
}
|
|
462
|
+
static compare(oneParam: Params['compare'][0], twoParam: Params['compare'][1]): Return['compare'] {
|
|
463
|
+
const one = ES.ToTemporalZonedDateTime(oneParam);
|
|
464
|
+
const two = ES.ToTemporalZonedDateTime(twoParam);
|
|
465
|
+
const ns1 = GetSlot(one, EPOCHNANOSECONDS);
|
|
466
|
+
const ns2 = GetSlot(two, EPOCHNANOSECONDS);
|
|
467
|
+
if (JSBI.lessThan(JSBI.BigInt(ns1), JSBI.BigInt(ns2))) return -1;
|
|
468
|
+
if (JSBI.greaterThan(JSBI.BigInt(ns1), JSBI.BigInt(ns2))) return 1;
|
|
469
|
+
return 0;
|
|
470
|
+
}
|
|
471
|
+
[Symbol.toStringTag]!: 'Temporal.ZonedDateTime';
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
MakeIntrinsicClass(ZonedDateTime, 'Temporal.ZonedDateTime');
|
|
475
|
+
|
|
476
|
+
function dateTime(zdt: Temporal.ZonedDateTime) {
|
|
477
|
+
return ES.GetISODateTimeFor(GetSlot(zdt, TIME_ZONE), GetSlot(zdt, EPOCHNANOSECONDS));
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
function getCalendarProperty<P extends keyof CalendarDateRecord>(
|
|
481
|
+
zdt: Temporal.ZonedDateTime,
|
|
482
|
+
prop: P
|
|
483
|
+
): CalendarDateRecord[P] {
|
|
484
|
+
ES.CheckReceiver(zdt, ES.IsTemporalZonedDateTime);
|
|
485
|
+
const isoDate = dateTime(zdt).isoDate;
|
|
486
|
+
return ES.calendarImplForObj(zdt).isoToDate(isoDate, { [prop]: true })[prop];
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
function getTimeProperty(zdt: Temporal.ZonedDateTime, prop: Temporal.TimeUnit) {
|
|
490
|
+
ES.CheckReceiver(zdt, ES.IsTemporalZonedDateTime);
|
|
491
|
+
return dateTime(zdt).time[prop];
|
|
492
|
+
}
|