@rvoh/dream 2.2.2 → 2.3.0-alpha.1
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/dist/cjs/src/Dream.js +10 -15
- package/dist/cjs/src/db/dataTypes.js +1 -0
- package/dist/cjs/src/db/index.js +2 -2
- package/dist/cjs/src/dream/QueryDriver/Base.js +2 -2
- package/dist/cjs/src/dream/QueryDriver/Kysely.js +2 -2
- package/dist/cjs/src/dream/QueryDriver/helpers/kysely/checkForNeedToBeRunMigrations.js +2 -2
- package/dist/cjs/src/dream/QueryDriver/helpers/kysely/migrationFolderPath.js +6 -1
- package/dist/cjs/src/dream/QueryDriver/helpers/kysely/runMigration.js +2 -2
- package/dist/cjs/src/dream/internal/saveDream.js +1 -1
- package/dist/cjs/src/dream/internal/softDeleteDream.js +1 -1
- package/dist/cjs/src/dream-app/helpers/globalModelKeyFromPath.js +5 -2
- package/dist/cjs/src/dream-app/helpers/globalSerializerKeyFromPath.js +5 -2
- package/dist/cjs/src/dream-app/helpers/importers/importModels.js +1 -0
- package/dist/cjs/src/dream-app/helpers/normalizeFilePath.js +3 -0
- package/dist/cjs/src/dream-app/index.js +3 -3
- package/dist/cjs/src/helpers/areEqual.js +2 -2
- package/dist/cjs/src/helpers/cli/ASTBuilder.js +2 -2
- package/dist/cjs/src/helpers/cloneDeepSafe.js +2 -2
- package/dist/cjs/src/helpers/customPgParsers.js +2 -2
- package/dist/cjs/src/helpers/loadRepl.js +2 -2
- package/dist/cjs/src/helpers/path/PathHelpers.js +27 -0
- package/dist/cjs/src/helpers/path/convertToFileURL.js +7 -0
- package/dist/cjs/src/helpers/path/windowsSafePath.js +22 -0
- package/dist/cjs/src/helpers/sortBy.js +2 -2
- package/dist/cjs/src/helpers/sqlAttributes.js +2 -2
- package/dist/cjs/src/helpers/stringCasing.js +2 -2
- package/dist/cjs/src/package-exports/errors.js +2 -1
- package/dist/cjs/src/package-exports/index.js +2 -2
- package/dist/cjs/src/package-exports/system.js +1 -0
- package/dist/cjs/src/serializer/SerializerRenderer.js +2 -2
- package/dist/cjs/src/types/calendardate.js +1 -0
- package/dist/cjs/src/types/datetime.js +1 -0
- package/dist/cjs/src/utils/datetime/CalendarDate.js +489 -0
- package/dist/cjs/src/utils/datetime/DateTime.js +919 -0
- package/dist/cjs/src/utils/datetime/helpers/isoTimeDecimalString.js +8 -0
- package/dist/cjs/src/utils/datetime/helpers/microsecondParts.js +16 -0
- package/dist/cjs/src/utils/datetime/helpers/replaceISOMicroseconds.js +10 -0
- package/dist/esm/src/Dream.js +10 -15
- package/dist/esm/src/db/dataTypes.js +1 -0
- package/dist/esm/src/db/index.js +2 -2
- package/dist/esm/src/dream/QueryDriver/Base.js +2 -2
- package/dist/esm/src/dream/QueryDriver/Kysely.js +2 -2
- package/dist/esm/src/dream/QueryDriver/helpers/kysely/checkForNeedToBeRunMigrations.js +2 -2
- package/dist/esm/src/dream/QueryDriver/helpers/kysely/migrationFolderPath.js +6 -1
- package/dist/esm/src/dream/QueryDriver/helpers/kysely/runMigration.js +2 -2
- package/dist/esm/src/dream/internal/saveDream.js +1 -1
- package/dist/esm/src/dream/internal/softDeleteDream.js +1 -1
- package/dist/esm/src/dream-app/helpers/globalModelKeyFromPath.js +5 -2
- package/dist/esm/src/dream-app/helpers/globalSerializerKeyFromPath.js +5 -2
- package/dist/esm/src/dream-app/helpers/importers/importModels.js +1 -0
- package/dist/esm/src/dream-app/helpers/normalizeFilePath.js +3 -0
- package/dist/esm/src/dream-app/index.js +3 -3
- package/dist/esm/src/helpers/areEqual.js +2 -2
- package/dist/esm/src/helpers/cli/ASTBuilder.js +2 -2
- package/dist/esm/src/helpers/cloneDeepSafe.js +2 -2
- package/dist/esm/src/helpers/customPgParsers.js +2 -2
- package/dist/esm/src/helpers/loadRepl.js +2 -2
- package/dist/esm/src/helpers/path/PathHelpers.js +27 -0
- package/dist/esm/src/helpers/path/convertToFileURL.js +7 -0
- package/dist/esm/src/helpers/path/windowsSafePath.js +22 -0
- package/dist/esm/src/helpers/sortBy.js +2 -2
- package/dist/esm/src/helpers/sqlAttributes.js +2 -2
- package/dist/esm/src/helpers/stringCasing.js +2 -2
- package/dist/esm/src/package-exports/errors.js +2 -1
- package/dist/esm/src/package-exports/index.js +2 -2
- package/dist/esm/src/package-exports/system.js +1 -0
- package/dist/esm/src/serializer/SerializerRenderer.js +2 -2
- package/dist/esm/src/types/calendardate.js +1 -0
- package/dist/esm/src/types/datetime.js +1 -0
- package/dist/esm/src/utils/datetime/CalendarDate.js +489 -0
- package/dist/esm/src/utils/datetime/DateTime.js +919 -0
- package/dist/esm/src/utils/datetime/helpers/isoTimeDecimalString.js +8 -0
- package/dist/esm/src/utils/datetime/helpers/microsecondParts.js +16 -0
- package/dist/esm/src/utils/datetime/helpers/replaceISOMicroseconds.js +10 -0
- package/dist/types/src/Dream.d.ts +2 -2
- package/dist/types/src/db/dataTypes.d.ts +2 -2
- package/dist/types/src/dream-app/helpers/normalizeFilePath.d.ts +1 -0
- package/dist/types/src/helpers/customPgParsers.d.ts +3 -2
- package/dist/types/src/helpers/path/PathHelpers.d.ts +21 -0
- package/dist/types/src/helpers/path/convertToFileURL.d.ts +1 -0
- package/dist/types/src/helpers/path/windowsSafePath.d.ts +20 -0
- package/dist/types/src/helpers/range.d.ts +2 -2
- package/dist/types/src/helpers/sort.d.ts +2 -2
- package/dist/types/src/helpers/sortBy.d.ts +2 -2
- package/dist/types/src/package-exports/errors.d.ts +2 -1
- package/dist/types/src/package-exports/index.d.ts +2 -2
- package/dist/types/src/package-exports/system.d.ts +1 -0
- package/dist/types/src/package-exports/types.d.ts +2 -0
- package/dist/types/src/types/associations/shared.d.ts +2 -2
- package/dist/types/src/types/associations/shared.ts +2 -2
- package/dist/types/src/types/calendardate.d.ts +4 -0
- package/dist/types/src/types/calendardate.ts +8 -0
- package/dist/types/src/types/datetime.d.ts +102 -0
- package/dist/types/src/types/datetime.ts +141 -0
- package/dist/types/src/types/dream.d.ts +2 -2
- package/dist/types/src/types/dream.ts +2 -2
- package/dist/types/src/types/moduleDeclarations/luxon.d.ts +5 -6
- package/dist/types/src/utils/datetime/CalendarDate.d.ts +375 -0
- package/dist/types/src/utils/datetime/DateTime.d.ts +597 -0
- package/dist/types/src/utils/datetime/helpers/isoTimeDecimalString.d.ts +4 -0
- package/dist/types/src/utils/datetime/helpers/microsecondParts.d.ts +10 -0
- package/dist/types/src/utils/datetime/helpers/replaceISOMicroseconds.d.ts +3 -0
- package/docs/assets/highlight.css +7 -0
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/db.DreamMigrationHelpers.html +9 -9
- package/docs/classes/db.KyselyQueryDriver.html +33 -33
- package/docs/classes/db.PostgresQueryDriver.html +34 -34
- package/docs/classes/db.QueryDriverBase.html +32 -32
- package/docs/classes/errors.CheckConstraintViolation.html +3 -3
- package/docs/classes/errors.ColumnOverflow.html +3 -3
- package/docs/classes/errors.CreateOrFindByFailedToCreateAndFind.html +3 -3
- package/docs/classes/errors.DataIncompatibleWithDatabaseField.html +3 -3
- package/docs/classes/errors.DataTypeColumnTypeMismatch.html +3 -3
- package/docs/classes/errors.GlobalNameNotSet.html +3 -3
- package/docs/classes/errors.InvalidCalendarDate.html +7 -2
- package/docs/classes/errors.InvalidDateTime.html +17 -0
- package/docs/classes/errors.MissingSerializersDefinition.html +3 -3
- package/docs/classes/errors.NonLoadedAssociation.html +3 -3
- package/docs/classes/errors.NotNullViolation.html +3 -3
- package/docs/classes/errors.RecordNotFound.html +3 -3
- package/docs/classes/errors.ValidationError.html +3 -3
- package/docs/classes/index.CalendarDate.html +195 -2
- package/docs/classes/index.DateTime.html +375 -0
- package/docs/classes/index.Decorators.html +19 -19
- package/docs/classes/index.Dream.html +121 -121
- package/docs/classes/index.DreamApp.html +5 -5
- package/docs/classes/index.DreamTransaction.html +2 -2
- package/docs/classes/index.Env.html +2 -2
- package/docs/classes/index.Query.html +59 -59
- package/docs/classes/system.CliFileWriter.html +2 -2
- package/docs/classes/system.DreamBin.html +2 -2
- package/docs/classes/system.DreamCLI.html +5 -5
- package/docs/classes/system.DreamImporter.html +2 -2
- package/docs/classes/system.DreamLogos.html +2 -2
- package/docs/classes/system.DreamSerializerBuilder.html +8 -8
- package/docs/classes/system.ObjectSerializerBuilder.html +8 -8
- package/docs/classes/system.PathHelpers.html +13 -0
- package/docs/classes/utils.Encrypt.html +2 -2
- package/docs/classes/utils.Range.html +2 -2
- package/docs/functions/db.closeAllDbConnections.html +1 -1
- package/docs/functions/db.dreamDbConnections.html +1 -1
- package/docs/functions/db.untypedDb.html +1 -1
- package/docs/functions/db.validateColumn.html +1 -1
- package/docs/functions/db.validateTable.html +1 -1
- package/docs/functions/errors.pgErrorType.html +1 -1
- package/docs/functions/index.DreamSerializer.html +1 -1
- package/docs/functions/index.ObjectSerializer.html +1 -1
- package/docs/functions/index.ReplicaSafe.html +1 -1
- package/docs/functions/index.STI.html +1 -1
- package/docs/functions/index.SoftDelete.html +1 -1
- package/docs/functions/utils.camelize.html +1 -1
- package/docs/functions/utils.capitalize.html +1 -1
- package/docs/functions/utils.cloneDeepSafe.html +1 -1
- package/docs/functions/utils.compact.html +2 -2
- package/docs/functions/utils.groupBy.html +1 -1
- package/docs/functions/utils.hyphenize.html +1 -1
- package/docs/functions/utils.intersection.html +1 -1
- package/docs/functions/utils.isEmpty.html +1 -1
- package/docs/functions/utils.normalizeUnicode.html +1 -1
- package/docs/functions/utils.pascalize.html +1 -1
- package/docs/functions/utils.percent.html +1 -1
- package/docs/functions/utils.range-1.html +1 -1
- package/docs/functions/utils.round.html +1 -1
- package/docs/functions/utils.sanitizeString.html +1 -1
- package/docs/functions/utils.snakeify.html +1 -1
- package/docs/functions/utils.sort.html +1 -1
- package/docs/functions/utils.sortBy.html +1 -1
- package/docs/functions/utils.sortObjectByKey.html +1 -1
- package/docs/functions/utils.sortObjectByValue.html +1 -1
- package/docs/functions/utils.uncapitalize.html +1 -1
- package/docs/functions/utils.uniq.html +1 -1
- package/docs/interfaces/openapi.OpenapiDescription.html +2 -2
- package/docs/interfaces/openapi.OpenapiSchemaProperties.html +1 -1
- package/docs/interfaces/openapi.OpenapiSchemaPropertiesShorthand.html +1 -1
- package/docs/interfaces/openapi.OpenapiTypeFieldObject.html +1 -1
- package/docs/interfaces/types.BelongsToStatement.html +2 -2
- package/docs/interfaces/types.DecoratorContext.html +2 -2
- package/docs/interfaces/types.DreamAppInitOptions.html +2 -2
- package/docs/interfaces/types.DreamAppOpts.html +2 -2
- package/docs/interfaces/types.DurationObject.html +12 -0
- package/docs/interfaces/types.EncryptOptions.html +2 -2
- package/docs/interfaces/types.InternalAnyTypedSerializerRendersMany.html +2 -2
- package/docs/interfaces/types.InternalAnyTypedSerializerRendersOne.html +2 -2
- package/docs/interfaces/types.SerializerRendererOpts.html +2 -2
- package/docs/modules/db.html +1 -1
- package/docs/modules/errors.html +2 -1
- package/docs/modules/index.html +3 -4
- package/docs/modules/openapi.html +1 -1
- package/docs/modules/system.html +2 -1
- package/docs/modules/types.html +6 -2
- package/docs/modules/utils.html +1 -1
- package/docs/types/openapi.CommonOpenapiSchemaObjectFields.html +1 -1
- package/docs/types/openapi.OpenapiAllTypes.html +1 -1
- package/docs/types/openapi.OpenapiFormats.html +1 -1
- package/docs/types/openapi.OpenapiNumberFormats.html +1 -1
- package/docs/types/openapi.OpenapiPrimitiveBaseTypes.html +1 -1
- package/docs/types/openapi.OpenapiPrimitiveTypes.html +1 -1
- package/docs/types/openapi.OpenapiSchemaArray.html +1 -1
- package/docs/types/openapi.OpenapiSchemaArrayShorthand.html +1 -1
- package/docs/types/openapi.OpenapiSchemaBase.html +1 -1
- package/docs/types/openapi.OpenapiSchemaBody.html +1 -1
- package/docs/types/openapi.OpenapiSchemaBodyShorthand.html +1 -1
- package/docs/types/openapi.OpenapiSchemaCommonFields.html +1 -1
- package/docs/types/openapi.OpenapiSchemaExpressionAllOf.html +1 -1
- package/docs/types/openapi.OpenapiSchemaExpressionAnyOf.html +1 -1
- package/docs/types/openapi.OpenapiSchemaExpressionOneOf.html +1 -1
- package/docs/types/openapi.OpenapiSchemaExpressionRef.html +1 -1
- package/docs/types/openapi.OpenapiSchemaExpressionRefSchemaShorthand.html +1 -1
- package/docs/types/openapi.OpenapiSchemaInteger.html +1 -1
- package/docs/types/openapi.OpenapiSchemaNull.html +1 -1
- package/docs/types/openapi.OpenapiSchemaNumber.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObject.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObjectAllOf.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObjectAllOfShorthand.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObjectAnyOf.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObjectAnyOfShorthand.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObjectBase.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObjectBaseShorthand.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObjectOneOf.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObjectOneOfShorthand.html +1 -1
- package/docs/types/openapi.OpenapiSchemaObjectShorthand.html +1 -1
- package/docs/types/openapi.OpenapiSchemaPrimitiveGeneric.html +1 -1
- package/docs/types/openapi.OpenapiSchemaShorthandExpressionAllOf.html +1 -1
- package/docs/types/openapi.OpenapiSchemaShorthandExpressionAnyOf.html +1 -1
- package/docs/types/openapi.OpenapiSchemaShorthandExpressionOneOf.html +1 -1
- package/docs/types/openapi.OpenapiSchemaShorthandExpressionSerializableRef.html +1 -1
- package/docs/types/openapi.OpenapiSchemaShorthandExpressionSerializerRef.html +1 -1
- package/docs/types/openapi.OpenapiSchemaShorthandPrimitiveGeneric.html +1 -1
- package/docs/types/openapi.OpenapiSchemaString.html +1 -1
- package/docs/types/openapi.OpenapiShorthandAllTypes.html +1 -1
- package/docs/types/openapi.OpenapiShorthandPrimitiveBaseTypes.html +1 -1
- package/docs/types/openapi.OpenapiShorthandPrimitiveTypes.html +1 -1
- package/docs/types/openapi.OpenapiTypeField.html +1 -1
- package/docs/types/system.DreamAppAllowedPackageManagersEnum.html +1 -1
- package/docs/types/types.CalendarDateDurationUnit.html +1 -0
- package/docs/types/types.Camelized.html +1 -1
- package/docs/types/types.DbConnectionType.html +1 -1
- package/docs/types/types.DbTypes.html +1 -1
- package/docs/types/types.DreamAssociationMetadata.html +1 -1
- package/docs/types/types.DreamAttributes.html +1 -1
- package/docs/types/types.DreamClassAssociationAndStatement.html +1 -1
- package/docs/types/types.DreamClassColumn.html +1 -1
- package/docs/types/types.DreamColumn.html +1 -1
- package/docs/types/types.DreamColumnNames.html +1 -1
- package/docs/types/types.DreamLogLevel.html +1 -1
- package/docs/types/types.DreamLogger.html +1 -1
- package/docs/types/types.DreamModelSerializerType.html +1 -1
- package/docs/types/types.DreamOrViewModelClassSerializerKey.html +1 -1
- package/docs/types/types.DreamOrViewModelSerializerKey.html +1 -1
- package/docs/types/types.DreamParamSafeAttributes.html +1 -1
- package/docs/types/types.DreamParamSafeColumnNames.html +1 -1
- package/docs/types/types.DreamSerializable.html +1 -1
- package/docs/types/types.DreamSerializableArray.html +1 -1
- package/docs/types/types.DreamSerializerKey.html +1 -1
- package/docs/types/types.DreamSerializers.html +1 -1
- package/docs/types/types.DreamVirtualColumns.html +1 -1
- package/docs/types/types.DurationUnit.html +4 -0
- package/docs/types/types.EncryptAlgorithm.html +1 -1
- package/docs/types/types.HasManyStatement.html +1 -1
- package/docs/types/types.HasOneStatement.html +1 -1
- package/docs/types/types.Hyphenized.html +1 -1
- package/docs/types/types.Pascalized.html +1 -1
- package/docs/types/types.PrimaryKeyType.html +1 -1
- package/docs/types/types.RoundingPrecision.html +1 -1
- package/docs/types/types.SerializerCasing.html +1 -1
- package/docs/types/types.SimpleObjectSerializerType.html +1 -1
- package/docs/types/types.Snakeified.html +1 -1
- package/docs/types/types.StrictInterface.html +1 -1
- package/docs/types/types.UpdateableAssociationProperties.html +1 -1
- package/docs/types/types.UpdateableProperties.html +1 -1
- package/docs/types/types.ValidationType.html +1 -1
- package/docs/types/types.ViewModel.html +1 -1
- package/docs/types/types.ViewModelClass.html +1 -1
- package/docs/types/types.WeekdayName.html +2 -0
- package/docs/types/types.WhereStatementForDream.html +1 -1
- package/docs/types/types.WhereStatementForDreamClass.html +1 -1
- package/docs/variables/index.DreamConst.html +1 -1
- package/docs/variables/index.ops.html +1 -1
- package/docs/variables/openapi.openapiPrimitiveTypes-1.html +1 -1
- package/docs/variables/openapi.openapiShorthandPrimitiveTypes-1.html +1 -1
- package/docs/variables/system.DreamAppAllowedPackageManagersEnumValues.html +1 -1
- package/docs/variables/system.primaryKeyTypes.html +1 -1
- package/package.json +9 -3
- package/dist/cjs/src/helpers/CalendarDate.js +0 -151
- package/dist/cjs/src/helpers/DateTime.js +0 -4
- package/dist/esm/src/helpers/CalendarDate.js +0 -151
- package/dist/esm/src/helpers/DateTime.js +0 -4
- package/dist/types/src/helpers/CalendarDate.d.ts +0 -56
- package/dist/types/src/helpers/DateTime.d.ts +0 -6
- package/dist/types/src/types/luxon/_util.d.ts +0 -20
- package/dist/types/src/types/luxon/datetime.d.ts +0 -1759
- package/dist/types/src/types/luxon/duration.d.ts +0 -494
- package/dist/types/src/types/luxon/info.d.ts +0 -217
- package/dist/types/src/types/luxon/interval.d.ts +0 -357
- package/dist/types/src/types/luxon/misc.d.ts +0 -67
- package/dist/types/src/types/luxon/settings.d.ts +0 -91
- package/dist/types/src/types/luxon/zone.d.ts +0 -172
- package/docs/types/index.DateTime.html +0 -1
- package/docs/variables/index.DateTime-1.html +0 -1
|
@@ -0,0 +1,597 @@
|
|
|
1
|
+
import * as luxon from 'luxon';
|
|
2
|
+
import { DateTime as LuxonDateTime } from 'luxon';
|
|
3
|
+
import { DateTimeFormatOptions, DateTimeJSOptions, DateTimeObject, DateTimeOptions, DateTimeUnit, DiffResult, DurationLikeObject, DurationUnit, LocaleOptions, ToISOTimeOptions, ToSQLOptions, WeekdayName, Zone } from '../../types/datetime.js';
|
|
4
|
+
export declare const Settings: typeof luxon.Settings;
|
|
5
|
+
/**
|
|
6
|
+
* DateTime wraps Luxon DateTime with microsecond precision (0-999).
|
|
7
|
+
* The decimal part in ISO/SQL is 6 digits: first 3 = milliseconds, next 3 = microseconds.
|
|
8
|
+
*/
|
|
9
|
+
export declare class DateTime {
|
|
10
|
+
protected readonly luxonDatetime: LuxonDateTime;
|
|
11
|
+
protected readonly _microseconds: number;
|
|
12
|
+
/**
|
|
13
|
+
* Microsecond part of the DateTime (NOT microseconds since Unix epoch)
|
|
14
|
+
*
|
|
15
|
+
* This value will not exceed 999 because above that will carry over to the
|
|
16
|
+
* millisecond part of the DateTime
|
|
17
|
+
*
|
|
18
|
+
* @returns The microsecond of the second (0–999)
|
|
19
|
+
*/
|
|
20
|
+
get microsecond(): number;
|
|
21
|
+
get year(): number;
|
|
22
|
+
get month(): number;
|
|
23
|
+
get day(): number;
|
|
24
|
+
get hour(): number;
|
|
25
|
+
get minute(): number;
|
|
26
|
+
get second(): number;
|
|
27
|
+
get millisecond(): number;
|
|
28
|
+
get weekday(): number;
|
|
29
|
+
/**
|
|
30
|
+
* Returns the lowercase name of the weekday.
|
|
31
|
+
* @returns Weekday name: 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', or 'sunday'
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* DateTime.fromISO('2026-02-09T09:00:00Z').weekdayName // 'monday' (Feb 9, 2026 is a Monday)
|
|
35
|
+
* DateTime.fromISO('2026-02-07T09:00:00Z').weekdayName // 'saturday'
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
get weekdayName(): WeekdayName;
|
|
39
|
+
get weekNumber(): number;
|
|
40
|
+
get weekYear(): number;
|
|
41
|
+
get ordinal(): number;
|
|
42
|
+
get quarter(): number;
|
|
43
|
+
get zoneName(): string;
|
|
44
|
+
get offset(): number;
|
|
45
|
+
get isValid(): boolean;
|
|
46
|
+
get invalidReason(): string | null;
|
|
47
|
+
get invalidExplanation(): string | null;
|
|
48
|
+
get locale(): string;
|
|
49
|
+
get zone(): Zone;
|
|
50
|
+
protected constructor(luxonDatetime: LuxonDateTime, microseconds?: number);
|
|
51
|
+
/**
|
|
52
|
+
* Returns the underlying Luxon DateTime instance.
|
|
53
|
+
* Since Luxon is immutable, it is safe to return the actual object.
|
|
54
|
+
* @returns The Luxon DateTime instance
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* const dt = DateTime.now()
|
|
58
|
+
* const luxon = dt.toLuxon()
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
toLuxon(): LuxonDateTime;
|
|
62
|
+
/**
|
|
63
|
+
* Returns the current time in the system's local zone.
|
|
64
|
+
* @returns A DateTime for the current instant
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* const now = DateTime.now()
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
static now(): DateTime;
|
|
71
|
+
/**
|
|
72
|
+
* Create a local DateTime. Accepts the same overloads as Luxon plus an optional microsecond (8th numeric arg).
|
|
73
|
+
* The last argument may be an options object instead of a time component.
|
|
74
|
+
* @param yearOrOpts - Year, or options object when called with no args or opts only
|
|
75
|
+
* @param month - Month (1–12)
|
|
76
|
+
* @param day - Day of month
|
|
77
|
+
* @param hour - Hour (0–23)
|
|
78
|
+
* @param minute - Minute (0–59)
|
|
79
|
+
* @param second - Second (0–59)
|
|
80
|
+
* @param millisecond - Millisecond (0–999)
|
|
81
|
+
* @param microsecondOrOpts - Microsecond (0–999) or options object
|
|
82
|
+
* @param opts - Options (zone, locale, etc.)
|
|
83
|
+
* @returns A DateTime in the local zone
|
|
84
|
+
* @example
|
|
85
|
+
* ```ts
|
|
86
|
+
* DateTime.local() // now
|
|
87
|
+
* DateTime.local(2017, 3, 12) // 2017-03-12T00:00:00
|
|
88
|
+
* DateTime.local(2017, 3, 12, 5, 45, 10, 765, 123) // with microsecond
|
|
89
|
+
* DateTime.local(2017, 3, 12, { zone: 'utc' }) // with options
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
static local(year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number, microsecond: number, opts?: DateTimeJSOptions): DateTime;
|
|
93
|
+
static local(year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number, opts?: DateTimeJSOptions): DateTime;
|
|
94
|
+
static local(year: number, month: number, day: number, hour: number, minute: number, second: number, opts?: DateTimeJSOptions): DateTime;
|
|
95
|
+
static local(year: number, month: number, day: number, hour: number, minute: number, opts?: DateTimeJSOptions): DateTime;
|
|
96
|
+
static local(year: number, month: number, day: number, hour: number, opts?: DateTimeJSOptions): DateTime;
|
|
97
|
+
static local(year: number, month: number, day: number, opts?: DateTimeJSOptions): DateTime;
|
|
98
|
+
static local(year: number, month: number, opts?: DateTimeJSOptions): DateTime;
|
|
99
|
+
static local(year: number, opts?: DateTimeJSOptions): DateTime;
|
|
100
|
+
static local(opts?: DateTimeJSOptions): DateTime;
|
|
101
|
+
/**
|
|
102
|
+
* Create a UTC DateTime. Accepts the same overloads as Luxon plus an optional microsecond (8th numeric arg).
|
|
103
|
+
* The last argument may be an options object instead of a time component.
|
|
104
|
+
* @param yearOrOpts - Year, or options object when called with no args or opts only
|
|
105
|
+
* @param month - Month (1–12)
|
|
106
|
+
* @param day - Day of month
|
|
107
|
+
* @param hour - Hour (0–23)
|
|
108
|
+
* @param minute - Minute (0–59)
|
|
109
|
+
* @param second - Second (0–59)
|
|
110
|
+
* @param millisecond - Millisecond (0–999)
|
|
111
|
+
* @param microsecondOrOpts - Microsecond (0–999) or options object
|
|
112
|
+
* @param options - Options (locale, etc.)
|
|
113
|
+
* @returns A DateTime in UTC
|
|
114
|
+
* @example
|
|
115
|
+
* ```ts
|
|
116
|
+
* DateTime.utc() // now in UTC
|
|
117
|
+
* DateTime.utc(2017, 3, 12, 5, 45, 10, 765, 123) // with microsecond
|
|
118
|
+
* DateTime.utc(2017, 3, 12, { locale: 'fr' }) // with options
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
static utc(year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number, microsecond: number, options?: LocaleOptions): DateTime;
|
|
122
|
+
static utc(year: number, month: number, day: number, hour: number, minute: number, second: number, options?: LocaleOptions): DateTime;
|
|
123
|
+
static utc(year: number, month: number, day: number, hour: number, minute: number, options?: LocaleOptions): DateTime;
|
|
124
|
+
static utc(year: number, month: number, day: number, hour: number, options?: LocaleOptions): DateTime;
|
|
125
|
+
static utc(year: number, month: number, day: number, options?: LocaleOptions): DateTime;
|
|
126
|
+
static utc(year: number, month: number, options?: LocaleOptions): DateTime;
|
|
127
|
+
static utc(year: number, options?: LocaleOptions): DateTime;
|
|
128
|
+
static utc(options?: LocaleOptions): DateTime;
|
|
129
|
+
/**
|
|
130
|
+
* Create a DateTime from a JavaScript Date.
|
|
131
|
+
* @param date - A JavaScript Date instance
|
|
132
|
+
* @param options - Optional zone for the result
|
|
133
|
+
* @returns A DateTime representing the same instant
|
|
134
|
+
* @example
|
|
135
|
+
* ```ts
|
|
136
|
+
* DateTime.fromJSDate(new Date())
|
|
137
|
+
* DateTime.fromJSDate(new Date(), { zone: 'America/New_York' })
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
static fromJSDate(date: Date, options?: DateTimeJSOptions): DateTime;
|
|
141
|
+
/**
|
|
142
|
+
* Create a DateTime from epoch milliseconds.
|
|
143
|
+
* @param milliseconds - Unix timestamp in milliseconds
|
|
144
|
+
* @param options - Optional zone/locale options
|
|
145
|
+
* @returns A DateTime for the given instant
|
|
146
|
+
* @example
|
|
147
|
+
* ```ts
|
|
148
|
+
* DateTime.fromMillis(1707234567890)
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
static fromMillis(milliseconds: number, options?: DateTimeJSOptions): DateTime;
|
|
152
|
+
/**
|
|
153
|
+
* Create a DateTime from epoch microseconds.
|
|
154
|
+
* @param microseconds - Unix timestamp in microseconds (milliseconds from quotient, microsecond from remainder)
|
|
155
|
+
* @param options - Optional zone/locale options
|
|
156
|
+
* @returns A DateTime for the given instant
|
|
157
|
+
* @example
|
|
158
|
+
* ```ts
|
|
159
|
+
* DateTime.fromMicroseconds(1707234567890123)
|
|
160
|
+
* ```
|
|
161
|
+
*/
|
|
162
|
+
static fromMicroseconds(microsecondsInput: number, options?: DateTimeJSOptions): DateTime;
|
|
163
|
+
/**
|
|
164
|
+
* Create a DateTime from epoch seconds.
|
|
165
|
+
* @param seconds - Unix timestamp in seconds
|
|
166
|
+
* @param options - Optional zone/locale options
|
|
167
|
+
* @returns A DateTime for the given instant
|
|
168
|
+
* @example
|
|
169
|
+
* ```ts
|
|
170
|
+
* DateTime.fromSeconds(1707234567)
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
static fromSeconds(seconds: number, options?: DateTimeJSOptions): DateTime;
|
|
174
|
+
/**
|
|
175
|
+
* Create a DateTime from an object with date/time units.
|
|
176
|
+
* Fractional milliseconds are converted to microseconds (e.g., 1.5 ms = 1 ms + 500 µs).
|
|
177
|
+
* @param obj - Object with year, month, day, etc.; supports optional microsecond
|
|
178
|
+
* @param opts - Optional zone/locale options
|
|
179
|
+
* @returns A DateTime for the given components
|
|
180
|
+
* @example
|
|
181
|
+
* ```ts
|
|
182
|
+
* DateTime.fromObject({ year: 2017, month: 3, day: 12, hour: 5, minute: 45, microsecond: 123 })
|
|
183
|
+
* DateTime.fromObject({ year: 2017, month: 3, day: 12, millisecond: 1.5 }) // 1ms + 500µs
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
186
|
+
static fromObject(obj: DateTimeObject, opts?: DateTimeJSOptions): DateTime;
|
|
187
|
+
/**
|
|
188
|
+
* Create a DateTime from an ISO 8601 string.
|
|
189
|
+
* @param text - ISO string (e.g. "2024-03-15T10:30:45.123456-05:00"); parses up to 6 fractional second digits
|
|
190
|
+
* @param opts - Optional parsing options
|
|
191
|
+
* @returns A DateTime for the parsed instant
|
|
192
|
+
* @example
|
|
193
|
+
* ```ts
|
|
194
|
+
* DateTime.fromISO('2024-03-15T10:30:45.123456-05:00')
|
|
195
|
+
* ```
|
|
196
|
+
*/
|
|
197
|
+
static fromISO(text: string, opts?: DateTimeOptions): DateTime;
|
|
198
|
+
/**
|
|
199
|
+
* Create a DateTime from an SQL datetime string.
|
|
200
|
+
* @param text - SQL string (e.g. "2024-03-15 10:30:45.123456"); parses up to 6 fractional second digits
|
|
201
|
+
* @param opts - Optional parsing options
|
|
202
|
+
* @returns A DateTime for the parsed instant
|
|
203
|
+
* @example
|
|
204
|
+
* ```ts
|
|
205
|
+
* DateTime.fromSQL('2024-03-15 10:30:45.123456')
|
|
206
|
+
* ```
|
|
207
|
+
*/
|
|
208
|
+
static fromSQL(text: string, opts?: DateTimeOptions): DateTime;
|
|
209
|
+
/**
|
|
210
|
+
* Returns an ISO 8601 string with 6 fractional second digits (milliseconds + microseconds).
|
|
211
|
+
* @param opts - Optional format options (includeOffset, suppressMilliseconds, etc.)
|
|
212
|
+
* @returns ISO string (e.g. "2024-03-15T10:30:45.123456-05:00")
|
|
213
|
+
* @example
|
|
214
|
+
* ```ts
|
|
215
|
+
* DateTime.fromISO('2024-03-15T10:30:45.123456').toISO()
|
|
216
|
+
* ```
|
|
217
|
+
*/
|
|
218
|
+
toISO(opts?: ToISOTimeOptions): string;
|
|
219
|
+
/**
|
|
220
|
+
* Returns an ISO date string (date only, no time).
|
|
221
|
+
* @returns ISO date string (e.g. "2024-03-15")
|
|
222
|
+
* @example
|
|
223
|
+
* ```ts
|
|
224
|
+
* DateTime.local(2017, 3, 12).toISODate()
|
|
225
|
+
* ```
|
|
226
|
+
*/
|
|
227
|
+
toISODate(): string;
|
|
228
|
+
/**
|
|
229
|
+
* Returns the time portion in ISO format with 6 fractional second digits.
|
|
230
|
+
* @param opts - Optional format options
|
|
231
|
+
* @returns Time string (e.g. "10:30:45.123456-05:00")
|
|
232
|
+
* @example
|
|
233
|
+
* ```ts
|
|
234
|
+
* DateTime.local(2017, 3, 12, 10, 30, 45, 123, 456).toISOTime()
|
|
235
|
+
* ```
|
|
236
|
+
*/
|
|
237
|
+
toISOTime(opts?: ToISOTimeOptions): string;
|
|
238
|
+
/**
|
|
239
|
+
* Returns an SQL datetime string with 6 fractional second digits.
|
|
240
|
+
* @param opts - Optional format options
|
|
241
|
+
* @returns SQL string (e.g. "2024-03-15 10:30:45.123456")
|
|
242
|
+
* @example
|
|
243
|
+
* ```ts
|
|
244
|
+
* DateTime.local(2017, 3, 12, 10, 30, 45, 123, 456).toSQL()
|
|
245
|
+
* ```
|
|
246
|
+
*/
|
|
247
|
+
toSQL(opts?: ToSQLOptions): string;
|
|
248
|
+
/**
|
|
249
|
+
* Returns an SQL date string (date only, no time).
|
|
250
|
+
* @returns SQL date string (e.g. "2024-03-15")
|
|
251
|
+
* @example
|
|
252
|
+
* ```ts
|
|
253
|
+
* DateTime.local(2017, 3, 12).toSQLDate()
|
|
254
|
+
* ```
|
|
255
|
+
*/
|
|
256
|
+
toSQLDate(): string;
|
|
257
|
+
/**
|
|
258
|
+
* Returns an SQL time string with 6 fractional second digits.
|
|
259
|
+
* @param opts - Optional format options
|
|
260
|
+
* @returns SQL time string (e.g. "10:30:45.123456")
|
|
261
|
+
* @example
|
|
262
|
+
* ```ts
|
|
263
|
+
* DateTime.local(2017, 3, 12, 10, 30, 45, 123, 456).toSQLTime()
|
|
264
|
+
* ```
|
|
265
|
+
*/
|
|
266
|
+
toSQLTime(opts?: ToSQLOptions): string;
|
|
267
|
+
/**
|
|
268
|
+
* Returns a JavaScript Date object.
|
|
269
|
+
* @returns JavaScript Date
|
|
270
|
+
* @example
|
|
271
|
+
* ```ts
|
|
272
|
+
* DateTime.local(2017, 3, 12).toJSDate()
|
|
273
|
+
* ```
|
|
274
|
+
*/
|
|
275
|
+
toJSDate(): Date;
|
|
276
|
+
/**
|
|
277
|
+
* Returns the epoch time in microseconds (for valueOf() operations).
|
|
278
|
+
* Includes full microsecond precision.
|
|
279
|
+
* @returns Unix timestamp in microseconds
|
|
280
|
+
* @example
|
|
281
|
+
* ```ts
|
|
282
|
+
* DateTime.local(2017, 3, 12).valueOf()
|
|
283
|
+
* DateTime.fromISO('2026-02-07T09:03:44.123456Z').valueOf() // includes microseconds
|
|
284
|
+
* ```
|
|
285
|
+
*/
|
|
286
|
+
valueOf(): number;
|
|
287
|
+
/**
|
|
288
|
+
* Returns an ISO 8601 formatted string for JSON serialization.
|
|
289
|
+
* This ensures DateTime objects are properly serialized to ISO format.
|
|
290
|
+
* @returns ISO datetime string with microsecond precision
|
|
291
|
+
* @example
|
|
292
|
+
* ```ts
|
|
293
|
+
* DateTime.fromISO('2026-02-07T09:03:44.123456Z').toJSON() // '2026-02-07T09:03:44.123456Z'
|
|
294
|
+
* JSON.stringify({ time: DateTime.now() }) // Uses toJSON() automatically
|
|
295
|
+
* ```
|
|
296
|
+
*/
|
|
297
|
+
toJSON(): string;
|
|
298
|
+
/**
|
|
299
|
+
* Returns an ISO 8601 formatted string representation.
|
|
300
|
+
* Alias for toISO().
|
|
301
|
+
* @returns ISO datetime string with microsecond precision
|
|
302
|
+
* @example
|
|
303
|
+
* ```ts
|
|
304
|
+
* DateTime.fromISO('2026-02-07T09:03:44.123456Z').toString() // '2026-02-07T09:03:44.123456Z'
|
|
305
|
+
* const dt = DateTime.local(2017, 3, 12, 10, 30, 45, 123, 456)
|
|
306
|
+
* `The time is ${dt}` // Uses toString() implicitly
|
|
307
|
+
* ```
|
|
308
|
+
*/
|
|
309
|
+
toString(): string;
|
|
310
|
+
/**
|
|
311
|
+
* Returns a localized string representation.
|
|
312
|
+
* @param formatOpts - Optional format options
|
|
313
|
+
* @param opts - Optional locale options
|
|
314
|
+
* @returns Localized string
|
|
315
|
+
* @example
|
|
316
|
+
* ```ts
|
|
317
|
+
* DateTime.local(2017, 3, 12).toLocaleString()
|
|
318
|
+
* ```
|
|
319
|
+
*/
|
|
320
|
+
toLocaleString(formatOpts?: DateTimeFormatOptions, opts?: LocaleOptions): string;
|
|
321
|
+
/**
|
|
322
|
+
* Returns a string representation using a format string.
|
|
323
|
+
* Supports all Luxon format tokens. Fractional second tokens (S, SSS, SSSSSS) are enhanced
|
|
324
|
+
* to include microseconds beyond Luxon's millisecond precision.
|
|
325
|
+
*
|
|
326
|
+
* @param fmt - Format string (e.g., 'yyyy-MM-dd HH:mm:ss', 'yyyy-MM-dd HH:mm:ss.SSSSSS')
|
|
327
|
+
* @param opts - Optional locale options
|
|
328
|
+
* @returns Formatted string
|
|
329
|
+
* @example
|
|
330
|
+
* ```ts
|
|
331
|
+
* DateTime.local(2017, 3, 12).toFormat('yyyy-MM-dd') // '2017-03-12'
|
|
332
|
+
* DateTime.local(2017, 3, 12, 10, 30, 45, 123, 456).toFormat('yyyy-MM-dd HH:mm:ss.SSSSSS') // '2017-03-12 10:30:45.123456'
|
|
333
|
+
* ```
|
|
334
|
+
*/
|
|
335
|
+
toFormat(fmt: string, opts?: LocaleOptions): string;
|
|
336
|
+
/**
|
|
337
|
+
* Adds a duration to this DateTime. Supports microsecond via DurationLikeObject.
|
|
338
|
+
* Fractional milliseconds are converted to microseconds (e.g., 1.5 ms = 1 ms + 500 µs).
|
|
339
|
+
* @param duration - Duration to add (DurationLikeObject with microsecond, or milliseconds number)
|
|
340
|
+
* @returns A new DateTime
|
|
341
|
+
* @example
|
|
342
|
+
* ```ts
|
|
343
|
+
* DateTime.local(2017, 3, 12).plus({ hours: 2 })
|
|
344
|
+
* DateTime.local(2017, 3, 12, 0, 0, 0, 0, 500).plus({ microseconds: 600 })
|
|
345
|
+
* DateTime.local(2017, 3, 12).plus({ milliseconds: 1.5 }) // adds 1ms + 500µs
|
|
346
|
+
* ```
|
|
347
|
+
*/
|
|
348
|
+
plus(duration: DurationLikeObject | number): DateTime;
|
|
349
|
+
/**
|
|
350
|
+
* Subtracts a duration from this DateTime. Supports microsecond via DurationLikeObject.
|
|
351
|
+
* Fractional milliseconds are converted to microseconds (e.g., 1.5 ms = 1 ms + 500 µs).
|
|
352
|
+
* @param duration - Duration to subtract
|
|
353
|
+
* @returns A new DateTime
|
|
354
|
+
* @example
|
|
355
|
+
* ```ts
|
|
356
|
+
* DateTime.local(2017, 3, 12, 14).minus({ hours: 2 })
|
|
357
|
+
* DateTime.local(2017, 3, 12).minus({ milliseconds: 1.5 }) // subtracts 1ms + 500µs
|
|
358
|
+
* ```
|
|
359
|
+
*/
|
|
360
|
+
minus(duration: DurationLikeObject | number): DateTime;
|
|
361
|
+
/**
|
|
362
|
+
* Returns a new DateTime with the given units set.
|
|
363
|
+
* @param values - Object with units to set (year, month, day, hour, minute, second, millisecond, microsecond)
|
|
364
|
+
* @returns A new DateTime
|
|
365
|
+
* @example
|
|
366
|
+
* ```ts
|
|
367
|
+
* DateTime.local(2017, 3, 12).set({ hour: 14, microsecond: 500 })
|
|
368
|
+
* ```
|
|
369
|
+
*/
|
|
370
|
+
set(values: DateTimeObject): DateTime;
|
|
371
|
+
/**
|
|
372
|
+
* Returns an object with date/time components including microsecond.
|
|
373
|
+
* @param opts - Optional options (includeConfig for Luxon config)
|
|
374
|
+
* @returns Object with year, month, day, hour, minute, second, millisecond, microsecond
|
|
375
|
+
* @example
|
|
376
|
+
* ```ts
|
|
377
|
+
* DateTime.local(2017, 3, 12, 5, 45, 10, 123, 456).toObject()
|
|
378
|
+
* ```
|
|
379
|
+
*/
|
|
380
|
+
toObject(opts?: {
|
|
381
|
+
includeConfig?: boolean;
|
|
382
|
+
}): DateTimeObject;
|
|
383
|
+
/**
|
|
384
|
+
* Returns true if this and other represent the same instant and microsecond.
|
|
385
|
+
* @param other - DateTime to compare
|
|
386
|
+
* @returns true if equal
|
|
387
|
+
* @example
|
|
388
|
+
* ```ts
|
|
389
|
+
* dt1.equals(dt2)
|
|
390
|
+
* ```
|
|
391
|
+
*/
|
|
392
|
+
equals(other: DateTime): boolean;
|
|
393
|
+
/**
|
|
394
|
+
* Returns the epoch time in milliseconds (toMillis * 1000 + millisecond).
|
|
395
|
+
* @returns Unix timestamp in milliseconds
|
|
396
|
+
* @example
|
|
397
|
+
* ```ts
|
|
398
|
+
* DateTime.fromMicroseconds(1770455024077750).toMillis() // 1770455024077.75
|
|
399
|
+
* ```
|
|
400
|
+
*/
|
|
401
|
+
toMillis(): number;
|
|
402
|
+
/**
|
|
403
|
+
* Returns the epoch time in microseconds (toMillis * 1000 + microsecond).
|
|
404
|
+
* @returns Unix timestamp in microseconds
|
|
405
|
+
* @example
|
|
406
|
+
* ```ts
|
|
407
|
+
* DateTime.fromMicroseconds(1707234567890123).toMicroseconds() // 1707234567890123
|
|
408
|
+
* ```
|
|
409
|
+
*/
|
|
410
|
+
toMicroseconds(): number;
|
|
411
|
+
/**
|
|
412
|
+
* Returns the epoch time in seconds, including fractional milliseconds.
|
|
413
|
+
* Includes microsecond precision in the fractional part.
|
|
414
|
+
* @returns Unix timestamp in seconds (with fractional milliseconds)
|
|
415
|
+
* @example
|
|
416
|
+
* ```ts
|
|
417
|
+
* DateTime.fromSeconds(1707234567).toSeconds() // 1707234567
|
|
418
|
+
* DateTime.fromISO('2026-02-07T09:03:44.123456Z').toSeconds() // includes .123456 in fractional part
|
|
419
|
+
* ```
|
|
420
|
+
*/
|
|
421
|
+
toSeconds(): number;
|
|
422
|
+
/**
|
|
423
|
+
* Returns the epoch time in seconds as an integer (floor of toSeconds).
|
|
424
|
+
* Truncates any fractional seconds, returning only the whole seconds portion.
|
|
425
|
+
* Equivalent to Math.floor(toSeconds()).
|
|
426
|
+
* @returns Unix timestamp in seconds (integer only, no fractional part)
|
|
427
|
+
* @example
|
|
428
|
+
* ```ts
|
|
429
|
+
* DateTime.fromSeconds(1707234567).toUnixInteger() // 1707234567
|
|
430
|
+
* DateTime.fromISO('2026-02-07T09:03:44.123456Z').toUnixInteger() // 1770455024 (fractional part truncated)
|
|
431
|
+
* DateTime.fromISO('2026-02-07T09:03:44.999999Z').toUnixInteger() // 1770455024 (not rounded up)
|
|
432
|
+
* ```
|
|
433
|
+
*/
|
|
434
|
+
toUnixInteger(): number;
|
|
435
|
+
/**
|
|
436
|
+
* Returns the earliest DateTime from the given arguments.
|
|
437
|
+
* @param dateTimes - DateTimes to compare
|
|
438
|
+
* @returns The earliest DateTime, or null if empty
|
|
439
|
+
* @example
|
|
440
|
+
* ```ts
|
|
441
|
+
* DateTime.min(dt1, dt2, dt3)
|
|
442
|
+
* ```
|
|
443
|
+
*/
|
|
444
|
+
static min(...dateTimes: DateTime[]): DateTime | null;
|
|
445
|
+
/**
|
|
446
|
+
* Returns the latest DateTime from the given arguments.
|
|
447
|
+
* @param dateTimes - DateTimes to compare
|
|
448
|
+
* @returns The latest DateTime, or null if empty
|
|
449
|
+
* @example
|
|
450
|
+
* ```ts
|
|
451
|
+
* DateTime.max(dt1, dt2, dt3)
|
|
452
|
+
* ```
|
|
453
|
+
*/
|
|
454
|
+
static max(...dateTimes: DateTime[]): DateTime | null;
|
|
455
|
+
/**
|
|
456
|
+
* Returns a new DateTime in the given zone. Microsecond is preserved.
|
|
457
|
+
* @param zone - Zone name or Zone instance
|
|
458
|
+
* @param opts - Optional zone options (keepLocalTime, etc.)
|
|
459
|
+
* @returns A new DateTime
|
|
460
|
+
* @example
|
|
461
|
+
* ```ts
|
|
462
|
+
* DateTime.local(2017, 3, 12).setZone('utc')
|
|
463
|
+
* ```
|
|
464
|
+
*/
|
|
465
|
+
setZone(zone?: string | Zone, opts?: {
|
|
466
|
+
keepLocalTime?: boolean;
|
|
467
|
+
}): DateTime;
|
|
468
|
+
/**
|
|
469
|
+
* Returns a new DateTime in UTC. Microsecond is preserved.
|
|
470
|
+
* @param offset - Optional offset in minutes
|
|
471
|
+
* @param opts - Optional zone options
|
|
472
|
+
* @returns A new DateTime in UTC
|
|
473
|
+
* @example
|
|
474
|
+
* ```ts
|
|
475
|
+
* DateTime.local(2017, 3, 12).toUTC()
|
|
476
|
+
* ```
|
|
477
|
+
*/
|
|
478
|
+
toUTC(offset?: number, opts?: {
|
|
479
|
+
keepLocalTime?: boolean;
|
|
480
|
+
}): DateTime;
|
|
481
|
+
/**
|
|
482
|
+
* Returns a new DateTime in the system's local zone. Microsecond is preserved.
|
|
483
|
+
* @returns A new DateTime in local zone
|
|
484
|
+
* @example
|
|
485
|
+
* ```ts
|
|
486
|
+
* dtUTC.toLocal()
|
|
487
|
+
* ```
|
|
488
|
+
*/
|
|
489
|
+
toLocal(): DateTime;
|
|
490
|
+
/**
|
|
491
|
+
* Returns a new DateTime at the start of the given unit.
|
|
492
|
+
* Microsecond is 0 except when unit is 'millisecond' (then preserved).
|
|
493
|
+
* @param unit - Unit to truncate to (year, month, day, hour, minute, second, millisecond)
|
|
494
|
+
* @param opts - Optional options
|
|
495
|
+
* @returns A new DateTime
|
|
496
|
+
* @example
|
|
497
|
+
* ```ts
|
|
498
|
+
* DateTime.local(2017, 3, 12, 14, 30).startOf('day') // 2017-03-12T00:00:00
|
|
499
|
+
* DateTime.local(2017, 3, 12, 14, 30).startOf('hour') // 2017-03-12T14:00:00
|
|
500
|
+
* ```
|
|
501
|
+
*/
|
|
502
|
+
startOf(unit: DateTimeUnit, opts?: {
|
|
503
|
+
useLocaleWeeks?: boolean;
|
|
504
|
+
}): DateTime;
|
|
505
|
+
/**
|
|
506
|
+
* Returns a new DateTime at the end of the given unit.
|
|
507
|
+
* Microsecond is 999 when unit is 'millisecond', else 0.
|
|
508
|
+
* @param unit - Unit to extend to end of
|
|
509
|
+
* @param opts - Optional options
|
|
510
|
+
* @returns A new DateTime
|
|
511
|
+
* @example
|
|
512
|
+
* ```ts
|
|
513
|
+
* DateTime.local(2017, 3, 12).endOf('month') // 2017-03-31T23:59:59.999999
|
|
514
|
+
* DateTime.local(2017, 3, 12).endOf('day') // 2017-03-12T23:59:59.999999
|
|
515
|
+
* ```
|
|
516
|
+
*/
|
|
517
|
+
endOf(unit: DateTimeUnit, opts?: {
|
|
518
|
+
useLocaleWeeks?: boolean;
|
|
519
|
+
}): DateTime;
|
|
520
|
+
/**
|
|
521
|
+
* Returns a new DateTime with the given locale/zone options. Microsecond is preserved.
|
|
522
|
+
* @param properties - Locale and/or zone options
|
|
523
|
+
* @returns A new DateTime
|
|
524
|
+
* @example
|
|
525
|
+
* ```ts
|
|
526
|
+
* DateTime.local(2017, 3, 12).reconfigure({ locale: 'fr' })
|
|
527
|
+
* ```
|
|
528
|
+
*/
|
|
529
|
+
reconfigure(properties: LocaleOptions): DateTime;
|
|
530
|
+
/**
|
|
531
|
+
* Returns a new DateTime with the given locale. Microsecond is preserved.
|
|
532
|
+
* @param locale - Locale string (e.g. 'en-US', 'fr')
|
|
533
|
+
* @returns A new DateTime
|
|
534
|
+
* @example
|
|
535
|
+
* ```ts
|
|
536
|
+
* DateTime.local(2017, 3, 12).setLocale('fr')
|
|
537
|
+
* ```
|
|
538
|
+
*/
|
|
539
|
+
setLocale(locale: string): DateTime;
|
|
540
|
+
/**
|
|
541
|
+
* Returns true if this DateTime is in the same unit as another.
|
|
542
|
+
* @param other - DateTime to compare
|
|
543
|
+
* @param unit - Unit to compare
|
|
544
|
+
* @returns true if same
|
|
545
|
+
* @example
|
|
546
|
+
* ```ts
|
|
547
|
+
* dt1.hasSame(dt2, 'day')
|
|
548
|
+
* ```
|
|
549
|
+
*/
|
|
550
|
+
hasSame(other: DateTime, unit: DateTimeUnit): boolean;
|
|
551
|
+
/**
|
|
552
|
+
* Returns the difference between this and another DateTime.
|
|
553
|
+
*
|
|
554
|
+
* Supports microsecond precision when 'microseconds' is included in the unit parameter.
|
|
555
|
+
*
|
|
556
|
+
* @param other - DateTime to diff against
|
|
557
|
+
* @param unit - Unit or units to return (e.g., 'days', 'hours', ['days', 'hours', 'microseconds'])
|
|
558
|
+
* @returns Object with only the specified units (or all units if not specified)
|
|
559
|
+
* @example
|
|
560
|
+
* ```ts
|
|
561
|
+
* dt1.diff(dt2, 'days') // { days: 5 }
|
|
562
|
+
* dt1.diff(dt2, ['days', 'hours']) // { days: 5, hours: 3 }
|
|
563
|
+
* dt1.diff(dt2, ['milliseconds', 'microseconds']) // { milliseconds: 123, microseconds: 456 }
|
|
564
|
+
* dt1.diff(dt2) // { years: 0, months: 0, ..., milliseconds: 123 }
|
|
565
|
+
* ```
|
|
566
|
+
*/
|
|
567
|
+
diff<U extends DurationUnit | readonly DurationUnit[] | undefined = undefined>(other: DateTime, unit?: U): DiffResult<U>;
|
|
568
|
+
/**
|
|
569
|
+
* Returns the difference between this DateTime and now.
|
|
570
|
+
*
|
|
571
|
+
* Supports microsecond precision when 'microseconds' is included in the unit parameter.
|
|
572
|
+
*
|
|
573
|
+
* @param unit - Unit or units to return
|
|
574
|
+
* @returns Object with only the specified units (or all units if not specified)
|
|
575
|
+
* @example
|
|
576
|
+
* ```ts
|
|
577
|
+
* dt.diffNow('days') // { days: 5 }
|
|
578
|
+
* dt.diffNow(['days', 'hours', 'microseconds']) // { days: 5, hours: 3, microseconds: 123 }
|
|
579
|
+
* ```
|
|
580
|
+
*/
|
|
581
|
+
diffNow<U extends DurationUnit | readonly DurationUnit[] | undefined = undefined>(unit?: U): DiffResult<U>;
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* Thrown when a DateTime is invalid (e.g. invalid input or Luxon error).
|
|
585
|
+
* @param error - The original error (available as cause)
|
|
586
|
+
* @example
|
|
587
|
+
* ```ts
|
|
588
|
+
* try {
|
|
589
|
+
* DateTime.fromISO('invalid')
|
|
590
|
+
* } catch (e) {
|
|
591
|
+
* if (e instanceof InvalidDateTime) console.error(e.cause)
|
|
592
|
+
* }
|
|
593
|
+
* ```
|
|
594
|
+
*/
|
|
595
|
+
export declare class InvalidDateTime extends Error {
|
|
596
|
+
constructor(error: Error);
|
|
597
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalizes a microsecond value: values > 999 become whole milliseconds + remainder (0–999).
|
|
3
|
+
* Throws for negative.
|
|
4
|
+
*/
|
|
5
|
+
export declare function microsecondParts(microsecondInput: number, { errorIfNegative }?: {
|
|
6
|
+
errorIfNegative?: boolean;
|
|
7
|
+
}): {
|
|
8
|
+
milliseconds: number;
|
|
9
|
+
microseconds: number;
|
|
10
|
+
};
|
|
@@ -23,6 +23,8 @@
|
|
|
23
23
|
--dark-hl-10: #F44747;
|
|
24
24
|
--light-hl-11: #000000FF;
|
|
25
25
|
--dark-hl-11: #D4D4D4;
|
|
26
|
+
--light-hl-12: #EE0000;
|
|
27
|
+
--dark-hl-12: #D7BA7D;
|
|
26
28
|
--light-code-background: #FFFFFF;
|
|
27
29
|
--dark-code-background: #1E1E1E;
|
|
28
30
|
}
|
|
@@ -40,6 +42,7 @@
|
|
|
40
42
|
--hl-9: var(--light-hl-9);
|
|
41
43
|
--hl-10: var(--light-hl-10);
|
|
42
44
|
--hl-11: var(--light-hl-11);
|
|
45
|
+
--hl-12: var(--light-hl-12);
|
|
43
46
|
--code-background: var(--light-code-background);
|
|
44
47
|
} }
|
|
45
48
|
|
|
@@ -56,6 +59,7 @@
|
|
|
56
59
|
--hl-9: var(--dark-hl-9);
|
|
57
60
|
--hl-10: var(--dark-hl-10);
|
|
58
61
|
--hl-11: var(--dark-hl-11);
|
|
62
|
+
--hl-12: var(--dark-hl-12);
|
|
59
63
|
--code-background: var(--dark-code-background);
|
|
60
64
|
} }
|
|
61
65
|
|
|
@@ -72,6 +76,7 @@
|
|
|
72
76
|
--hl-9: var(--light-hl-9);
|
|
73
77
|
--hl-10: var(--light-hl-10);
|
|
74
78
|
--hl-11: var(--light-hl-11);
|
|
79
|
+
--hl-12: var(--light-hl-12);
|
|
75
80
|
--code-background: var(--light-code-background);
|
|
76
81
|
}
|
|
77
82
|
|
|
@@ -88,6 +93,7 @@
|
|
|
88
93
|
--hl-9: var(--dark-hl-9);
|
|
89
94
|
--hl-10: var(--dark-hl-10);
|
|
90
95
|
--hl-11: var(--dark-hl-11);
|
|
96
|
+
--hl-12: var(--dark-hl-12);
|
|
91
97
|
--code-background: var(--dark-code-background);
|
|
92
98
|
}
|
|
93
99
|
|
|
@@ -103,4 +109,5 @@
|
|
|
103
109
|
.hl-9 { color: var(--hl-9); }
|
|
104
110
|
.hl-10 { color: var(--hl-10); }
|
|
105
111
|
.hl-11 { color: var(--hl-11); }
|
|
112
|
+
.hl-12 { color: var(--hl-12); }
|
|
106
113
|
pre, code { background: var(--code-background); }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
window.navigationData = "data:application/octet-stream;base64,
|
|
1
|
+
window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAE62bXXfjKBKG/4uvez+6d2d2t+8cO5nx6STOJOn0xZy+wFLFZoNAAyjdmj3z3/egDwskKJAydz7SW8+LJCihAv/6v5WG73r1cZUfVu9WJdGn1cdVIfKKgfpbfvjrSRds9W71Qnm++vjh3So7UZZL4KuPv55DtxJIcUOPkmgq+M/ASpBqoGWMKNXSvErX4/2Hf//x7oz+VCtg9S8VyHor6StIL3aiwpB3QumjBBWDenQY1pJdEAVe5EiD4TImFKwZ2x42gnPIzP2y7ulzxdtDBuvVuvAf/2mxc/MUUsBTIUKtuK5LyLeHAOx8HmG8EkZzomEjWFXwAMgVJdAeyYFBBNZoJqyvFg2kFHa37gdJezxpoGxOkL1sBFdaEsr1ExWsGQjTztJBQwFYz2lvy/4V5DMT38JoR4YCJRANe3lFeX5RXxHKIH8U7dE1z83hsEs8FrPeEk12PBNFSTQ9MPhC9ckcOxAFVxRY2DgaGbN9rMuuh5lfN1QVRGcn1M8fghn9xMSBsFtSwK3QD6CD+LEQg+5406k3hAHPidwS7clGHdejTUAb2SMtothehyFvqFKUHx9AUsLo7yDVFp4pp+i4wIIws1vBrwXJIV8rJTKKDz6fGIfr24qx+KgeCzHoPWRC5rdCX4kKGWeuDAM+tQmPCn5pQoPEkQ5DlsdGYjq9L8t2QEuF5lnKc/g+TbPN4bQsi3b8lpPa4cM9veWk9PCteTZEC9+cqKOcFSjHvI2DCHMyGr0uSxSwLsso41ESrkjm7+EWy9JhzEv+GsJc8tfojCsU25yMXkvzah0Qr0RSMw9wrqPRuKR/fLBAolRhgigVEtrwhyTmGzxWQwYhMufZH/4LmU5hjpUI9B5KRjPyQJ69A7zlWSIE9fC4CyMeHndYqHjWW2CgkUYMGjTHiBI4Kek0y3QnkvLMvtVuQWWSlu54oFyDfCaZhZzKRy4//Gg/x1b9kJ2gIHdSlCA1BZXiMI5ZYPNwElKfiP3CSfc7BycYm7dBMx1re2OK3SgEM9mIohDcaWYb1MRbN9N8mQxGkbCR49//86/3P3yYXtqaMdPUoMtIlki9ErIgOgbtVInM26o4gEwjO9pE/p2kBdX0FcxHb8o9mQbMdZrlMseh7Q5rKUkdwVvK+WzPAIyZhIYd7ubWKhCPacEiRhZ52i0ywtnkeTfIiZjl1eYCPF8EA2Y5XX4vJShFBV8ztn9OMhvFLPXj9Xw/E7PQb89htl8Ts9DvHua63cMbvNpD8zooBpjVkh3XcLSnfYhpp53FNx+uSXAjnEk2b5ZEtpHOoo/nFwjdO69IoaePW0u/1Gde//IFLnFOzhSWfqnPoit0Ahc4J78PB/lClyWX58Qt8E3PvJZ+qc+SC3QDFzgvMV3md54+/gQcJM2SDMdBsxzP7VwyVQgFv7kFySkhFPzWFqR36lDwW1vQF1FM5Sd1shHH/FmtAvkntKmBLGvRooESjJ7XBi0pP6YZNtJUet+6xI/8iX6uz+xPaCRysfcy3zme59pOxOWsi3EFXhcYyrW9gTfgL+/R+m/a7Qp6BSI9pnYJU9VKg7Uc0Fcw2+NpCyWMXlEGXyTVvj0QHclRRSvqF9SzKtCRekG8LH+9wyGb610UsitKIbELc1RR3LU4Cs8Cjs1qJFHQkFEvKsryWAMncsxgXNOPOQT06PYZok/BLT4d1tKkLEmtGRPfIL8j2Qs5wg3h5AhSXfKqGKcB+8aggbG8ECc8EVb5h29yI1oEkjpKSQsi609QB3NFZzZSoplBu6w+MWhPHvbnhQtggh/Vo3jQREMB3F+Xb4FTMVaRP690bgRvDoXBYymK7Z7FjlO9L0dbmqbkqToFvi91CtXIUFzV7n5DVjw6oCPEkJc8k3WZcOWuEEOa2pDkhK150+Nyex7Ic5DqhvAacUqKf1MD9hze4r/n4w93x36sBxl5/P4AdHXK2oPQP+vPnE6KVC0/pI5lug0pwDRrMqXqsd3paMa0tgG6Oz1s3FgVp3onlT0sae7YDrxhj84NaJITTQLQgDrNRWtJD5UOttgVJTE35t1pNWjNc0/enbhgYem+442WfhvfTssQNQqcyzKb3rDbbamSqNfieA2vMKliW8heksrzFNxdWkKVvd0aLXJgQyZBxllAneSyl08UvjXRzeMdEJ9gsmRn+aFxc50XmM73uyOSFGZHStLA9ajnuaR1WJ88yceuDyF8Wzab613ZDsCT1rZHHzH4w57/hK0toEnctDv9RKWuCGsfEAZ2hVF29C0/583eTebW7Cgk1afJx5Iz5TurYtSfSTM1i7yCxqoE6p5DHGqLosy6PAEPT22G8zHSHVEZQSZJw/koyflOC9AcTYx4bzb0Un68k5BR5Wwys6ETWYw7DIkNUZ4i6XhW26qiVFqUDMZlhfC9COujTpy8AH2moWc2nI+StKSZ3vUT+gDOFcWYn0vzp5ImSQ5TNN82PtsjEpTumW6UTh/2g4efpquJEvv3egDWn07mNJOSCKzRxIhfAF5yUps3sx9nCaKsE8ghp10JOdrG7WC92mUOyM1AAvxednWp0pR5qkvN4aTqUvdCmhYPW0R3Gqsb3hN+9OzIb+Obk1h01n3x+jYRt4hegexFzkhJNYlheg0GYoLDFqAMba7uWLYMw5k/PNlVpQmoFSCIoxRVeVGHEZ0AQZz6N28YcpYgmKbGomD0V4MxyVZhMHVZlBq5rE6AILjZ9Wqe52dOM5EjVzdWItCyn1uEaWcJhgGZOROrCaQVIAjpDqsxoDk9XpRyAe5flCaA6V+TnHBFzB+4fofxou2Y4+owYDsFQJ55r8AgQiJ31ZyNBGNDqT0fAXRbf2rn08lHsoSJyGaFIg3aSBFsxVNyoq1CYfQ3DEJ/mwR//ePr/wEhpblvzT4AAA=="
|