@rvoh/dream 2.2.3 → 2.3.0-alpha.2
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 +5 -5
- 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/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 +1140 -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 +5 -5
- 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/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 +1140 -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 +1 -1
- 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 +773 -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 +485 -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 +3 -2
- 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
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
import { WeekdayNumbers } from './datetime.js'
|
|
2
|
-
import { CalendarSystem, NumberingSystem, StringUnitLength, UnitLength } from './misc.js'
|
|
3
|
-
import { Zone } from './zone.js'
|
|
4
|
-
|
|
5
|
-
export interface InfoOptions {
|
|
6
|
-
locale?: string | undefined
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface InfoUnitOptions extends InfoOptions {
|
|
10
|
-
numberingSystem?: NumberingSystem | undefined
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/** @deprecated */
|
|
14
|
-
export type UnitOptions = InfoUnitOptions
|
|
15
|
-
|
|
16
|
-
export interface InfoCalendarOptions extends InfoUnitOptions {
|
|
17
|
-
/**
|
|
18
|
-
* @default gregory
|
|
19
|
-
*/
|
|
20
|
-
outputCalendar?: CalendarSystem | undefined
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* The set of available features in this environment. Some features of Luxon are not available in all environments.
|
|
25
|
-
*/
|
|
26
|
-
export interface Features {
|
|
27
|
-
/**
|
|
28
|
-
* Whether this environment supports relative time formatting
|
|
29
|
-
*/
|
|
30
|
-
relative: boolean
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Whether this environment supports different weekdays for the start of the week based on the locale
|
|
34
|
-
*/
|
|
35
|
-
localeWeek: boolean
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* The Info class contains static methods for retrieving general time and date related data. For example, it has methods for finding out if a time zone has a DST, for listing the months in any
|
|
40
|
-
* supported locale, and for discovering which of Luxon features are available in the current environment.
|
|
41
|
-
*/
|
|
42
|
-
export namespace Info {
|
|
43
|
-
/**
|
|
44
|
-
* Return whether the specified zone contains a DST.
|
|
45
|
-
*
|
|
46
|
-
* @param zone - Zone to check. Defaults to the environment's local zone. Defaults to 'local'.
|
|
47
|
-
*/
|
|
48
|
-
export function hasDST(zone?: string | Zone): boolean
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Return whether the specified zone is a valid IANA specifier.
|
|
52
|
-
*
|
|
53
|
-
* @param zone - Zone to check
|
|
54
|
-
*/
|
|
55
|
-
export function isValidIANAZone(zone: string): boolean
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Converts the input into a {@link Zone} instance.
|
|
59
|
-
*
|
|
60
|
-
* * If `input` is already a Zone instance, it is returned unchanged.
|
|
61
|
-
* * If `input` is a string containing a valid time zone name, a Zone instance
|
|
62
|
-
* with that name is returned.
|
|
63
|
-
* * If `input` is a string that doesn't refer to a known time zone, a Zone
|
|
64
|
-
* instance with {@link Zone.isValid} == false is returned.
|
|
65
|
-
* * If `input is a number, a Zone instance with the specified fixed offset
|
|
66
|
-
* in minutes is returned.
|
|
67
|
-
* * If `input` is `null` or `undefined`, the default zone is returned.
|
|
68
|
-
*
|
|
69
|
-
* @param input - the value to be converted
|
|
70
|
-
*/
|
|
71
|
-
export function normalizeZone(input?: string | Zone | number): Zone
|
|
72
|
-
|
|
73
|
-
interface LocaleInput {
|
|
74
|
-
/**
|
|
75
|
-
* the locale code
|
|
76
|
-
*/
|
|
77
|
-
locale?: string | null | undefined
|
|
78
|
-
/**
|
|
79
|
-
* an existing locale object to use, instead of the locale code string
|
|
80
|
-
*/
|
|
81
|
-
locObj?: object | null | undefined
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Get the weekday on which the week starts,
|
|
86
|
-
* according to the given locale.
|
|
87
|
-
*/
|
|
88
|
-
export function getStartOfWeek(input?: LocaleInput): WeekdayNumbers
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Get the minimum number of days necessary in a week before it is considered part of the next year,
|
|
92
|
-
* according to the given locale.
|
|
93
|
-
*/
|
|
94
|
-
export function getMinimumDaysInFirstWeek(input?: LocaleInput): WeekdayNumbers
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Get the weekdays which are considered the weekend,
|
|
98
|
-
* according to the given locale.
|
|
99
|
-
*/
|
|
100
|
-
export function getWeekendWeekdays(input?: LocaleInput): WeekdayNumbers[]
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Return an array of standalone month names.
|
|
104
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat
|
|
105
|
-
*
|
|
106
|
-
* @param length - the length of the month representation. Defaults to 'long'.
|
|
107
|
-
* @param opts - options
|
|
108
|
-
* @param opts.locale - the locale code
|
|
109
|
-
* @param opts.numberingSystem - the numbering system.
|
|
110
|
-
* @param opts.locObj - an existing locale object to use.
|
|
111
|
-
* @param opts.outputCalendar - the calendar. Defaults to 'gregory'.
|
|
112
|
-
*
|
|
113
|
-
* @example
|
|
114
|
-
* Info.months()[0] //=> 'January'
|
|
115
|
-
* @example
|
|
116
|
-
* Info.months('short')[0] //=> 'Jan'
|
|
117
|
-
* @example
|
|
118
|
-
* Info.months('numeric')[0] //=> '1'
|
|
119
|
-
* @example
|
|
120
|
-
* Info.months('short', { locale: 'fr-CA' } )[0] //=> 'janv.'
|
|
121
|
-
* @example
|
|
122
|
-
* Info.months('numeric', { locale: 'ar' })[0] //=> '١'
|
|
123
|
-
* @example
|
|
124
|
-
* Info.months('long', { outputCalendar: 'islamic' })[0] //=> 'Rabiʻ I'
|
|
125
|
-
*/
|
|
126
|
-
export function months(length?: UnitLength, opts?: InfoCalendarOptions): string[]
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Return an array of format month names.
|
|
130
|
-
* Format months differ from standalone months in that they are meant to appear next to the day of the month.
|
|
131
|
-
* In some languages, that changes the string.
|
|
132
|
-
* See {@link Info#months}
|
|
133
|
-
*
|
|
134
|
-
* @param length - the length of the month representation. Defaults to 'long'.
|
|
135
|
-
* @param opts - options
|
|
136
|
-
* @param opts.locale - the locale code
|
|
137
|
-
* @param opts.numberingSystem - the numbering system.
|
|
138
|
-
* @param opts.locObj - an existing locale object to use.
|
|
139
|
-
* @param opts.outputCalendar - the calendar. Defaults to 'gregory'.
|
|
140
|
-
*/
|
|
141
|
-
export function monthsFormat(length?: UnitLength, opts?: InfoCalendarOptions): string[]
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Return an array of standalone week names.
|
|
145
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat
|
|
146
|
-
*
|
|
147
|
-
* @param length - the length of the weekday representation. Defaults to 'long'.
|
|
148
|
-
* @param opts - options
|
|
149
|
-
* @param opts.locale - the locale code
|
|
150
|
-
* @param opts.numberingSystem - the numbering system.
|
|
151
|
-
* @param opts.locObj - an existing locale object to use.
|
|
152
|
-
*
|
|
153
|
-
* @example
|
|
154
|
-
* Info.weekdays()[0] //=> 'Monday'
|
|
155
|
-
* @example
|
|
156
|
-
* Info.weekdays('short')[0] //=> 'Mon'
|
|
157
|
-
* @example
|
|
158
|
-
* Info.weekdays('short', { locale: 'fr-CA' })[0] //=> 'lun.'
|
|
159
|
-
* @example
|
|
160
|
-
* Info.weekdays('short', { locale: 'ar' })[0] //=> 'الاثنين'
|
|
161
|
-
*/
|
|
162
|
-
export function weekdays(length?: StringUnitLength, opts?: InfoUnitOptions): string[]
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Return an array of format week names.
|
|
166
|
-
* Format weekdays differ from standalone weekdays in that they are meant to appear next to more date information.
|
|
167
|
-
* In some languages, that changes the string.
|
|
168
|
-
* See {@link Info#weekdays}
|
|
169
|
-
*
|
|
170
|
-
* @param length - the length of the month representation. Defaults to 'long'.
|
|
171
|
-
* @param opts - options
|
|
172
|
-
* @param opts.locale - the locale code.
|
|
173
|
-
* @param opts.numberingSystem - the numbering system.
|
|
174
|
-
* @param opts.locObj - an existing locale object to use.
|
|
175
|
-
*/
|
|
176
|
-
export function weekdaysFormat(length?: StringUnitLength, opts?: InfoUnitOptions): string[]
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Return an array of meridiems.
|
|
180
|
-
*
|
|
181
|
-
* @param opts - options
|
|
182
|
-
* @param opts.locale - the locale code
|
|
183
|
-
*
|
|
184
|
-
* @example
|
|
185
|
-
* Info.meridiems() //=> [ 'AM', 'PM' ]
|
|
186
|
-
* @example
|
|
187
|
-
* Info.meridiems({ locale: 'my' }) //=> [ 'နံနက်', 'ညနေ' ]
|
|
188
|
-
*/
|
|
189
|
-
export function meridiems(opts?: InfoOptions): string[]
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* Return an array of eras, such as ['BC', 'AD']. The locale can be specified, but the calendar system is always Gregorian.
|
|
193
|
-
*
|
|
194
|
-
* @param length - the length of the era representation. Defaults to 'short'.
|
|
195
|
-
* @param opts - options
|
|
196
|
-
* @param opts.locale - the locale code
|
|
197
|
-
*
|
|
198
|
-
* @example
|
|
199
|
-
* Info.eras() //=> [ 'BC', 'AD' ]
|
|
200
|
-
* @example
|
|
201
|
-
* Info.eras('long') //=> [ 'Before Christ', 'Anno Domini' ]
|
|
202
|
-
* @example
|
|
203
|
-
* Info.eras('long', { locale: 'fr' }) //=> [ 'avant Jésus-Christ', 'après Jésus-Christ' ]
|
|
204
|
-
*/
|
|
205
|
-
export function eras(length?: StringUnitLength, opts?: InfoOptions): string[]
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Return the set of available features in this environment.
|
|
209
|
-
* Some features of Luxon are not available in all environments.
|
|
210
|
-
* For example, on older browsers, timezone support is not available.
|
|
211
|
-
* Use this function to figure out if that is the case.
|
|
212
|
-
*
|
|
213
|
-
* @example
|
|
214
|
-
* Info.features() //=> { intl: true, intlTokens: false, zones: true, relative: false }
|
|
215
|
-
*/
|
|
216
|
-
export function features(): Features
|
|
217
|
-
}
|
|
@@ -1,357 +0,0 @@
|
|
|
1
|
-
import { CanBeInvalid, DefaultValidity, IfValid, Invalid, Valid } from './_util.js'
|
|
2
|
-
import {
|
|
3
|
-
_UseLocaleWeekOption,
|
|
4
|
-
DateObjectUnits,
|
|
5
|
-
DateTime,
|
|
6
|
-
DateTimeOptions,
|
|
7
|
-
DiffOptions,
|
|
8
|
-
LocaleOptions,
|
|
9
|
-
ToISOTimeOptions,
|
|
10
|
-
} from './datetime.js'
|
|
11
|
-
import { DurationLike, DurationMaybeValid, DurationUnit } from './duration.js'
|
|
12
|
-
|
|
13
|
-
export interface IntervalObject {
|
|
14
|
-
start?: DateTime | undefined
|
|
15
|
-
end?: DateTime | undefined
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export type DateInput = DateTime | DateObjectUnits | Date
|
|
19
|
-
|
|
20
|
-
export type IntervalMaybeValid = CanBeInvalid extends true ? Interval<Valid> | Interval<Invalid> : Interval
|
|
21
|
-
|
|
22
|
-
export type CountOptions = _UseLocaleWeekOption
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* An Interval object represents a half-open interval of time, where each endpoint is a {@link DateTime}.
|
|
26
|
-
* Conceptually, it is a container for those two endpoints, accompanied by methods for
|
|
27
|
-
* creating, parsing, interrogating, comparing, transforming, and formatting them.
|
|
28
|
-
*
|
|
29
|
-
* Here is a brief overview of the most commonly used methods and getters in Interval:
|
|
30
|
-
*
|
|
31
|
-
* * **Creation** To create an Interval, use {@link Interval.fromDateTimes}, {@link Interval.after}, {@link Interval.before}, or {@link Interval.fromISO}.
|
|
32
|
-
* * **Accessors** Use {@link Interval#start} and {@link Interval#end} to get the start and end.
|
|
33
|
-
* * **Interrogation** To analyze the Interval, use {@link Interval#count}, {@link Interval#length}, {@link Interval#hasSame},
|
|
34
|
-
* * {@link Interval#contains}, {@link Interval#isAfter}, or {@link Interval#isBefore}.
|
|
35
|
-
* * **Transformation** To create other Intervals out of this one, use {@link Interval#set}, {@link Interval#splitAt}, {@link Interval#splitBy}, {@link Interval#divideEqually},
|
|
36
|
-
* * {@link Interval.merge}, {@link Interval.xor}, {@link Interval#union}, {@link Interval#intersection}, or {@link Interval#difference}.
|
|
37
|
-
* * **Comparison** To compare this Interval to another one, use {@link Interval#equals}, {@link Interval#overlaps}, {@link Interval#abutsStart}, {@link Interval#abutsEnd}, {@link Interval#engulfs}
|
|
38
|
-
* * **Output** To convert the Interval into other representations, see {@link Interval#toString}, {@link Interval#toLocaleString}, {@link Interval#toISO}, {@link Interval#toISODate},
|
|
39
|
-
* * {@link Interval#toISOTime}, {@link Interval#toFormat}, and {@link Interval#toDuration}.
|
|
40
|
-
*/
|
|
41
|
-
export class Interval<IsValid extends boolean = DefaultValidity> {
|
|
42
|
-
/**
|
|
43
|
-
* Create an invalid Interval.
|
|
44
|
-
*
|
|
45
|
-
* @param reason - simple string of why this Interval is invalid. Should not contain parameters or anything else data-dependent
|
|
46
|
-
* @param explanation - longer explanation, may include parameters and other useful debugging information.
|
|
47
|
-
*/
|
|
48
|
-
static invalid(reason: string, explanation?: string): Interval<Invalid>
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Create an Interval from a start DateTime and an end DateTime. Inclusive of the start but not the end.
|
|
52
|
-
*
|
|
53
|
-
* @param start
|
|
54
|
-
* @param end
|
|
55
|
-
*/
|
|
56
|
-
static fromDateTimes(start: DateInput, end: DateInput): IntervalMaybeValid
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Create an Interval from a start DateTime and a Duration to extend to.
|
|
60
|
-
*
|
|
61
|
-
* @param start
|
|
62
|
-
* @param duration - the length of the Interval.
|
|
63
|
-
*/
|
|
64
|
-
static after(start: DateInput, duration: DurationLike): IntervalMaybeValid
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Create an Interval from an end DateTime and a Duration to extend backwards to.
|
|
68
|
-
*
|
|
69
|
-
* @param end
|
|
70
|
-
* @param duration - the length of the Interval.
|
|
71
|
-
*/
|
|
72
|
-
static before(end: DateInput, duration: DurationLike): IntervalMaybeValid
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Create an Interval from an ISO 8601 string.
|
|
76
|
-
* Accepts `<start>/<end>`, `<start>/<duration>`, and `<duration>/<end>` formats.
|
|
77
|
-
* @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals
|
|
78
|
-
*
|
|
79
|
-
* @param text - the ISO string to parse
|
|
80
|
-
* @param opts - options to pass {@link DateTime.fromISO} and optionally {@link Duration.fromISO}
|
|
81
|
-
*/
|
|
82
|
-
static fromISO(text: string, opts?: DateTimeOptions): IntervalMaybeValid
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Check if an object is an Interval. Works across context boundaries
|
|
86
|
-
*
|
|
87
|
-
* @param o
|
|
88
|
-
*/
|
|
89
|
-
static isInterval(o: unknown): o is IntervalMaybeValid
|
|
90
|
-
|
|
91
|
-
private constructor(config: unknown)
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Returns the start of the Interval
|
|
95
|
-
*/
|
|
96
|
-
get start(): IfValid<DateTime<Valid>, null, IsValid>
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Returns the end of the Interval
|
|
100
|
-
*/
|
|
101
|
-
get end(): IfValid<DateTime<Valid>, null, IsValid>
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Returns whether this Interval's end is at least its start, meaning that the Interval isn't 'backwards'.
|
|
105
|
-
*/
|
|
106
|
-
get isValid(): IfValid<true, false, IsValid>
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Returns an error code if this Interval is invalid, or null if the Interval is valid
|
|
110
|
-
*/
|
|
111
|
-
get invalidReason(): IfValid<null, string, IsValid>
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Returns an explanation of why this Interval became invalid, or null if the Interval is valid
|
|
115
|
-
*/
|
|
116
|
-
get invalidExplanation(): IfValid<null, string | null, IsValid>
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Returns the length of the Interval in the specified unit.
|
|
120
|
-
*
|
|
121
|
-
* @param unit - the unit (such as 'hours' or 'days') to return the length in.
|
|
122
|
-
*/
|
|
123
|
-
length(unit?: DurationUnit): IfValid<number, typeof NaN, IsValid>
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Returns the count of minutes, hours, days, months, or years included in the Interval, even in part.
|
|
127
|
-
* Unlike {@link Interval#length} this counts sections of the calendar, not periods of time, e.g. specifying 'day'
|
|
128
|
-
* asks 'what dates are included in this interval?', not 'how many days long is this interval?'
|
|
129
|
-
*
|
|
130
|
-
* @param unit - the unit of time to count. Defaults to 'milliseconds'.
|
|
131
|
-
*/
|
|
132
|
-
count(unit?: DurationUnit, opts?: CountOptions): IfValid<number, typeof NaN, IsValid>
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Returns whether this Interval's start and end are both in the same unit of time
|
|
136
|
-
*
|
|
137
|
-
* @param unit - the unit of time to check sameness on
|
|
138
|
-
*/
|
|
139
|
-
hasSame(unit: DurationUnit): IfValid<boolean, false, IsValid>
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Return whether this Interval has the same start and end DateTimes.
|
|
143
|
-
*/
|
|
144
|
-
isEmpty(): boolean
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Return whether this Interval's start is after the specified DateTime.
|
|
148
|
-
*
|
|
149
|
-
* @param dateTime
|
|
150
|
-
*/
|
|
151
|
-
isAfter(dateTime: DateTime): IfValid<boolean, false, IsValid>
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Return whether this Interval's end is before the specified DateTime.
|
|
155
|
-
*
|
|
156
|
-
* @param dateTime
|
|
157
|
-
*/
|
|
158
|
-
isBefore(dateTime: DateTime): IfValid<boolean, false, IsValid>
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Return whether this Interval contains the specified DateTime.
|
|
162
|
-
*
|
|
163
|
-
* @param dateTime
|
|
164
|
-
*/
|
|
165
|
-
contains(dateTime: DateTime): IfValid<boolean, false, IsValid>
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* "Sets" the start and/or end dates. Returns a newly-constructed Interval.
|
|
169
|
-
*
|
|
170
|
-
* @param values - the values to set
|
|
171
|
-
* @param values.start - the starting DateTime
|
|
172
|
-
* @param values.end - the ending DateTime
|
|
173
|
-
*/
|
|
174
|
-
set(values?: IntervalObject): IntervalMaybeValid
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Split this Interval at each of the specified DateTimes
|
|
178
|
-
*
|
|
179
|
-
* @param dateTimes - the unit of time to count.
|
|
180
|
-
*/
|
|
181
|
-
splitAt(...dateTimes: DateTime[]): IfValid<Interval[], [], IsValid>
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Split this Interval into smaller Intervals, each of the specified length.
|
|
185
|
-
* Left over time is grouped into a smaller interval
|
|
186
|
-
*
|
|
187
|
-
* @param duration - The length of each resulting interval.
|
|
188
|
-
*/
|
|
189
|
-
splitBy(duration: DurationLike): IfValid<Interval[], [], IsValid>
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* Split this Interval into the specified number of smaller intervals.
|
|
193
|
-
*
|
|
194
|
-
* @param numberOfParts - The number of Intervals to divide the Interval into.
|
|
195
|
-
*/
|
|
196
|
-
divideEqually(numberOfParts: number): IfValid<Interval[], [], IsValid>
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Return whether this Interval overlaps with the specified Interval
|
|
200
|
-
*/
|
|
201
|
-
overlaps(other: Interval): boolean
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Return whether this Interval's end is adjacent to the specified Interval's start.
|
|
205
|
-
*/
|
|
206
|
-
abutsStart(other: Interval): IfValid<boolean, false, IsValid>
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
* Return whether this Interval's start is adjacent to the specified Interval's end.
|
|
210
|
-
*/
|
|
211
|
-
abutsEnd(other: Interval): IfValid<boolean, false, IsValid>
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* Return whether this Interval engulfs the start and end of the specified Interval.
|
|
215
|
-
*/
|
|
216
|
-
engulfs(other: Interval): IfValid<boolean, false, IsValid>
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Return whether this Interval has the same start and end as the specified Interval.
|
|
220
|
-
*/
|
|
221
|
-
equals(other: Interval): IfValid<boolean, false, IsValid>
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* Return an Interval representing the intersection of this Interval and the specified Interval.
|
|
225
|
-
* Specifically, the resulting Interval has the maximum start time and the minimum end time of the two Intervals.
|
|
226
|
-
* Returns null if the intersection is empty, meaning the intervals do not intersect.
|
|
227
|
-
*/
|
|
228
|
-
intersection(other: Interval): Interval | null
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* Return an Interval representing the union of this Interval and the specified Interval.
|
|
232
|
-
* Specifically, the resulting Interval has the minimum start time and the maximum end time of the two Intervals.
|
|
233
|
-
*/
|
|
234
|
-
union(other: Interval): IntervalMaybeValid
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* Merge an array of Intervals into an equivalent minimal set of Intervals.
|
|
238
|
-
* Combines overlapping and adjacent Intervals.
|
|
239
|
-
*/
|
|
240
|
-
static merge(intervals: Interval[]): IntervalMaybeValid[]
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* Return an array of Intervals representing the spans of time that only appear in one of the specified Intervals.
|
|
244
|
-
*/
|
|
245
|
-
static xor(intervals: Interval[]): IntervalMaybeValid[]
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Return Intervals representing the spans of time in this Interval that not overlap with any of the specified Intervals.
|
|
249
|
-
*/
|
|
250
|
-
difference(...intervals: Interval[]): IntervalMaybeValid[]
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* Returns a string representation of this Interval appropriate for debugging.
|
|
254
|
-
*/
|
|
255
|
-
toString(): IfValid<string, 'Invalid Interval', IsValid>
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* Returns a localized string representing this Interval. Accepts the same options as the
|
|
259
|
-
* Intl.DateTimeFormat constructor and any presets defined by Luxon, such as
|
|
260
|
-
* {@link DateTime.DATE_FULL} or {@link DateTime.TIME_SIMPLE}. The exact behavior of this method
|
|
261
|
-
* is browser-specific, but in general it will return an appropriate representation of the
|
|
262
|
-
* Interval in the assigned locale. Defaults to the system's locale if no locale has been
|
|
263
|
-
* specified.
|
|
264
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat
|
|
265
|
-
* @param formatOpts - Either a DateTime preset or Intl.DateTimeFormat constructor options. Defaults to DateTime.DATE_SHORT
|
|
266
|
-
* @param opts - Options to override the configuration of the start DateTime.
|
|
267
|
-
*
|
|
268
|
-
* @example
|
|
269
|
-
* Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(); //=> 11/7/2022 – 11/8/2022
|
|
270
|
-
* @example
|
|
271
|
-
* Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(DateTime.DATE_FULL); //=> November 7 – 8, 2022
|
|
272
|
-
* @example
|
|
273
|
-
* Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(DateTime.DATE_FULL, { locale: 'fr-FR' }); //=> 7–8 novembre 2022
|
|
274
|
-
* @example
|
|
275
|
-
* Interval.fromISO('2022-11-07T17:00Z/2022-11-07T19:00Z').toLocaleString(DateTime.TIME_SIMPLE); //=> 6:00 – 8:00 PM
|
|
276
|
-
* @example
|
|
277
|
-
* Interval.fromISO("2022-11-07T17:00Z/2022-11-07T19:00Z").toLocaleString({
|
|
278
|
-
* weekday: "short",
|
|
279
|
-
* month: "short",
|
|
280
|
-
* day: "2-digit",
|
|
281
|
-
* hour: "2-digit",
|
|
282
|
-
* minute: "2-digit",
|
|
283
|
-
* }); //=> Mon, Nov 07, 6:00 – 8:00 p
|
|
284
|
-
*/
|
|
285
|
-
toLocaleString(
|
|
286
|
-
formatOpts?: Intl.DateTimeFormatOptions,
|
|
287
|
-
opts?: LocaleOptions
|
|
288
|
-
): IfValid<string, 'Invalid Interval', IsValid>
|
|
289
|
-
|
|
290
|
-
/**
|
|
291
|
-
* Returns an ISO 8601-compliant string representation of this Interval.
|
|
292
|
-
* @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals
|
|
293
|
-
*
|
|
294
|
-
* @param opts - The same options as {@link DateTime#toISO}
|
|
295
|
-
*/
|
|
296
|
-
toISO(opts?: ToISOTimeOptions): IfValid<string, 'Invalid Interval', IsValid>
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* Returns an ISO 8601-compliant string representation of the dates in this Interval.
|
|
300
|
-
* The time components are ignored.
|
|
301
|
-
* @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals
|
|
302
|
-
*/
|
|
303
|
-
toISODate(): IfValid<string, 'Invalid Interval', IsValid>
|
|
304
|
-
|
|
305
|
-
/**
|
|
306
|
-
* Returns an ISO 8601-compliant string representation of the times in this Interval.
|
|
307
|
-
* The date components are ignored.
|
|
308
|
-
* @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals
|
|
309
|
-
*
|
|
310
|
-
* @param opts - The same options as {@link DateTime.toISO}
|
|
311
|
-
*/
|
|
312
|
-
toISOTime(opts?: ToISOTimeOptions): IfValid<string, 'Invalid Interval', IsValid>
|
|
313
|
-
|
|
314
|
-
/**
|
|
315
|
-
* Returns a string representation of this Interval formatted according to the specified format string.
|
|
316
|
-
*
|
|
317
|
-
* @param dateFormat - the format string. This string formats the start and end time. See {@link DateTime.toFormat} for details.
|
|
318
|
-
* @param opts - options
|
|
319
|
-
* @param opts.separator - a separator to place between the start and end representations. Defaults to ' - '.
|
|
320
|
-
*/
|
|
321
|
-
toFormat(
|
|
322
|
-
dateFormat: string,
|
|
323
|
-
opts?: {
|
|
324
|
-
separator?: string | undefined
|
|
325
|
-
}
|
|
326
|
-
): IfValid<string, 'Invalid Interval', IsValid>
|
|
327
|
-
|
|
328
|
-
/**
|
|
329
|
-
* Return a Duration representing the time spanned by this interval.
|
|
330
|
-
*
|
|
331
|
-
* @param unit - the unit or units (such as 'hours' or 'days') to include in the duration. Defaults to ['milliseconds'].
|
|
332
|
-
* @param opts - options that affect the creation of the Duration
|
|
333
|
-
* @param opts.conversionAccuracy - the conversion system to use. Defaults to 'casual'.
|
|
334
|
-
*
|
|
335
|
-
* @example
|
|
336
|
-
* Interval.fromDateTimes(dt1, dt2).toDuration().toObject() //=> { milliseconds: 88489257 }
|
|
337
|
-
* @example
|
|
338
|
-
* Interval.fromDateTimes(dt1, dt2).toDuration('days').toObject() //=> { days: 1.0241812152777778 }
|
|
339
|
-
* @example
|
|
340
|
-
* Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes']).toObject() //=> { hours: 24, minutes: 34.82095 }
|
|
341
|
-
* @example
|
|
342
|
-
* Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes', 'seconds']).toObject() //=> { hours: 24, minutes: 34, seconds: 49.257 }
|
|
343
|
-
* @example
|
|
344
|
-
* Interval.fromDateTimes(dt1, dt2).toDuration('seconds').toObject() //=> { seconds: 88489.257 }
|
|
345
|
-
*/
|
|
346
|
-
toDuration(unit?: DurationUnit | DurationUnit[], opts?: DiffOptions): DurationMaybeValid
|
|
347
|
-
|
|
348
|
-
/**
|
|
349
|
-
* Run mapFn on the interval start and end, returning a new Interval from the resulting DateTimes
|
|
350
|
-
*
|
|
351
|
-
* @example
|
|
352
|
-
* Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.toUTC())
|
|
353
|
-
* @example
|
|
354
|
-
* Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.plus({ hours: 2 }))
|
|
355
|
-
*/
|
|
356
|
-
mapEndpoints(mapFn: (d: DateTime) => DateTime): IntervalMaybeValid
|
|
357
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
export type DateTimeFormatOptions = Intl.DateTimeFormatOptions
|
|
2
|
-
|
|
3
|
-
export interface ZoneOptions {
|
|
4
|
-
/**
|
|
5
|
-
* If true, adjust the underlying time so that the local time stays the same, but in the target zone.
|
|
6
|
-
* You should rarely need this.
|
|
7
|
-
* Defaults to false.
|
|
8
|
-
*/
|
|
9
|
-
keepLocalTime?: boolean | undefined
|
|
10
|
-
/**
|
|
11
|
-
* @deprecated since 0.2.12. Use keepLocalTime instead
|
|
12
|
-
*/
|
|
13
|
-
keepCalendarTime?: boolean | undefined
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/** @deprecated */
|
|
17
|
-
export type EraLength = StringUnitLength
|
|
18
|
-
|
|
19
|
-
export type NumberingSystem = Intl.DateTimeFormatOptions extends { numberingSystem?: infer T }
|
|
20
|
-
? T
|
|
21
|
-
:
|
|
22
|
-
| 'arab'
|
|
23
|
-
| 'arabext'
|
|
24
|
-
| 'bali'
|
|
25
|
-
| 'beng'
|
|
26
|
-
| 'deva'
|
|
27
|
-
| 'fullwide'
|
|
28
|
-
| 'gujr'
|
|
29
|
-
| 'guru'
|
|
30
|
-
| 'hanidec'
|
|
31
|
-
| 'khmr'
|
|
32
|
-
| 'knda'
|
|
33
|
-
| 'laoo'
|
|
34
|
-
| 'latn'
|
|
35
|
-
| 'limb'
|
|
36
|
-
| 'mlym'
|
|
37
|
-
| 'mong'
|
|
38
|
-
| 'mymr'
|
|
39
|
-
| 'orya'
|
|
40
|
-
| 'tamldec'
|
|
41
|
-
| 'telu'
|
|
42
|
-
| 'thai'
|
|
43
|
-
| 'tibt'
|
|
44
|
-
|
|
45
|
-
export type CalendarSystem = Intl.DateTimeFormatOptions extends { calendar?: infer T }
|
|
46
|
-
? T
|
|
47
|
-
:
|
|
48
|
-
| 'buddhist'
|
|
49
|
-
| 'chinese'
|
|
50
|
-
| 'coptic'
|
|
51
|
-
| 'ethioaa'
|
|
52
|
-
| 'ethiopic'
|
|
53
|
-
| 'gregory'
|
|
54
|
-
| 'hebrew'
|
|
55
|
-
| 'indian'
|
|
56
|
-
| 'islamic'
|
|
57
|
-
| 'islamicc'
|
|
58
|
-
| 'iso8601'
|
|
59
|
-
| 'japanese'
|
|
60
|
-
| 'persian'
|
|
61
|
-
| 'roc'
|
|
62
|
-
|
|
63
|
-
export type HourCycle = 'h11' | 'h12' | 'h23' | 'h24'
|
|
64
|
-
|
|
65
|
-
export type StringUnitLength = 'narrow' | 'short' | 'long'
|
|
66
|
-
export type NumberUnitLength = 'numeric' | '2-digit'
|
|
67
|
-
export type UnitLength = StringUnitLength | NumberUnitLength
|