@types/luxon
Advanced tools
Comparing version 3.2.2 to 3.3.0
@@ -1,2 +0,2 @@ | ||
// Type definitions for luxon 3.2 | ||
// Type definitions for luxon 3.3 | ||
// Project: https://github.com/moment/luxon#readme | ||
@@ -3,0 +3,0 @@ // Definitions by: Hyeonseok Yang <https://github.com/FourwingsY> |
{ | ||
"name": "@types/luxon", | ||
"version": "3.2.2", | ||
"version": "3.3.0", | ||
"description": "TypeScript definitions for luxon", | ||
@@ -73,4 +73,4 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/luxon", | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "d42dffbee44bf8f0a5a7599305d1178db044ab77d80021b6d4fdcd8f974e6e49", | ||
"typesPublisherContentHash": "a421096acbb6140085f4f82f5bef80edbd98939c95cfdc61a96e768a089d8bd1", | ||
"typeScriptVersion": "4.3" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
### Additional Details | ||
* Last updated: Mon, 03 Apr 2023 20:33:03 GMT | ||
* Last updated: Tue, 04 Apr 2023 14:03:10 GMT | ||
* Dependencies: none | ||
@@ -14,0 +14,0 @@ * Global values: `luxon` |
@@ -13,2 +13,3 @@ import { | ||
import { Interval } from './interval'; | ||
import { CanBeInvalid, IfInvalid } from './_util'; | ||
@@ -205,3 +206,8 @@ export type DateTimeUnit = 'year' | 'quarter' | 'month' | 'week' | 'day' | 'hour' | 'minute' | 'second' | 'millisecond'; | ||
export type ToObjectOutput<IncludeConfig extends boolean | undefined = true> = | ||
export type ToObjectOutput<IncludeConfig extends boolean | undefined = undefined> = | ||
CanBeInvalid extends true | ||
? Partial<_ToObjectOutput<IncludeConfig>> | ||
: _ToObjectOutput<IncludeConfig>; | ||
/** @internal */ | ||
export type _ToObjectOutput<IncludeConfig extends boolean | undefined = undefined> = | ||
& Record<Exclude<DateTimeUnit, 'quarter' | 'week'>, number> | ||
@@ -804,3 +810,3 @@ & (IncludeConfig extends true ? LocaleOptions : unknown); | ||
*/ | ||
get locale(): string; | ||
get locale(): string | IfInvalid<null>; | ||
@@ -810,3 +816,3 @@ /** | ||
*/ | ||
get numberingSystem(): string; | ||
get numberingSystem(): string | IfInvalid<null>; | ||
@@ -816,3 +822,3 @@ /** | ||
*/ | ||
get outputCalendar(): string; | ||
get outputCalendar(): string | IfInvalid<null>; | ||
@@ -827,3 +833,3 @@ /** | ||
*/ | ||
get zoneName(): string; | ||
get zoneName(): string | IfInvalid<null>; | ||
@@ -835,3 +841,3 @@ /** | ||
*/ | ||
get year(): number; | ||
get year(): number | IfInvalid<typeof NaN>; | ||
@@ -843,3 +849,3 @@ /** | ||
*/ | ||
get quarter(): QuarterNumbers; | ||
get quarter(): QuarterNumbers | IfInvalid<typeof NaN>; | ||
@@ -851,3 +857,3 @@ /** | ||
*/ | ||
get month(): MonthNumbers; | ||
get month(): MonthNumbers | IfInvalid<typeof NaN>; | ||
@@ -859,3 +865,3 @@ /** | ||
*/ | ||
get day(): DayNumbers; | ||
get day(): DayNumbers | IfInvalid<typeof NaN>; | ||
@@ -867,3 +873,3 @@ /** | ||
*/ | ||
get hour(): HourNumbers; | ||
get hour(): HourNumbers | IfInvalid<typeof NaN>; | ||
@@ -876,3 +882,3 @@ /** | ||
*/ | ||
get minute(): MinuteNumbers; | ||
get minute(): MinuteNumbers | IfInvalid<typeof NaN>; | ||
@@ -885,3 +891,3 @@ /** | ||
*/ | ||
get second(): SecondNumbers; | ||
get second(): SecondNumbers | IfInvalid<typeof NaN>; | ||
@@ -894,3 +900,3 @@ /** | ||
*/ | ||
get millisecond(): number; | ||
get millisecond(): number | IfInvalid<typeof NaN>; | ||
@@ -904,3 +910,3 @@ /** | ||
*/ | ||
get weekYear(): number; | ||
get weekYear(): number | IfInvalid<typeof NaN>; | ||
@@ -914,3 +920,3 @@ /** | ||
*/ | ||
get weekNumber(): WeekNumbers; | ||
get weekNumber(): WeekNumbers | IfInvalid<typeof NaN>; | ||
@@ -925,3 +931,3 @@ /** | ||
*/ | ||
get weekday(): WeekdayNumbers; | ||
get weekday(): WeekdayNumbers | IfInvalid<typeof NaN>; | ||
@@ -934,3 +940,3 @@ /** | ||
*/ | ||
get ordinal(): number; | ||
get ordinal(): number | IfInvalid<typeof NaN>; | ||
@@ -944,3 +950,3 @@ /** | ||
*/ | ||
get monthShort(): string; | ||
get monthShort(): string | IfInvalid<null>; | ||
@@ -954,3 +960,3 @@ /** | ||
*/ | ||
get monthLong(): string; | ||
get monthLong(): string | IfInvalid<null>; | ||
@@ -964,3 +970,3 @@ /** | ||
*/ | ||
get weekdayShort(): string; | ||
get weekdayShort(): string | IfInvalid<null>; | ||
@@ -974,3 +980,3 @@ /** | ||
*/ | ||
get weekdayLong(): string; | ||
get weekdayLong(): string | IfInvalid<null>; | ||
@@ -985,3 +991,3 @@ /** | ||
*/ | ||
get offset(): number; | ||
get offset(): number | IfInvalid<typeof NaN>; | ||
@@ -992,3 +998,3 @@ /** | ||
*/ | ||
get offsetNameShort(): string; | ||
get offsetNameShort(): string | IfInvalid<null>; | ||
@@ -999,3 +1005,3 @@ /** | ||
*/ | ||
get offsetNameLong(): string; | ||
get offsetNameLong(): string | IfInvalid<null>; | ||
@@ -1005,3 +1011,3 @@ /** | ||
*/ | ||
get isOffsetFixed(): boolean; | ||
get isOffsetFixed(): boolean | IfInvalid<null>; | ||
@@ -1011,3 +1017,3 @@ /** | ||
*/ | ||
get isInDST(): boolean; | ||
get isInDST(): boolean | IfInvalid<false>; | ||
@@ -1032,3 +1038,3 @@ /** | ||
*/ | ||
get daysInMonth(): PossibleDaysInMonth; | ||
get daysInMonth(): PossibleDaysInMonth | IfInvalid<undefined>; | ||
@@ -1043,3 +1049,3 @@ /** | ||
*/ | ||
get daysInYear(): PossibleDaysInYear; | ||
get daysInYear(): PossibleDaysInYear | IfInvalid<typeof NaN>; | ||
@@ -1055,3 +1061,3 @@ /** | ||
*/ | ||
get weeksInWeekYear(): PossibleWeeksInYear; | ||
get weeksInWeekYear(): PossibleWeeksInYear | IfInvalid<typeof NaN>; | ||
@@ -1218,3 +1224,3 @@ /** | ||
*/ | ||
toFormat(fmt: string, opts?: LocaleOptions): string; | ||
toFormat(fmt: string, opts?: LocaleOptions): string | IfInvalid<'Invalid DateTime'>; | ||
@@ -1249,3 +1255,3 @@ /** | ||
*/ | ||
toLocaleString(formatOpts?: DateTimeFormatOptions, opts?: LocaleOptions): string; | ||
toLocaleString(formatOpts?: DateTimeFormatOptions, opts?: LocaleOptions): string | IfInvalid<'Invalid DateTime'>; | ||
@@ -1266,3 +1272,3 @@ /** | ||
*/ | ||
toLocaleParts(opts?: DateTimeFormatOptions): Intl.DateTimeFormatPart[]; | ||
toLocaleParts(opts?: DateTimeFormatOptions): Intl.DateTimeFormatPart[] | IfInvalid<[]>; | ||
@@ -1281,3 +1287,3 @@ /** | ||
*/ | ||
toISO(opts?: ToISOTimeOptions): string; | ||
toISO(opts?: ToISOTimeOptions): string | IfInvalid<null>; | ||
@@ -1295,3 +1301,3 @@ /** | ||
*/ | ||
toISODate(opts?: ToISODateOptions): string; | ||
toISODate(opts?: ToISODateOptions): string | IfInvalid<null>; | ||
@@ -1304,3 +1310,3 @@ /** | ||
*/ | ||
toISOWeekDate(): string; | ||
toISOWeekDate(): string | IfInvalid<null>; | ||
@@ -1326,3 +1332,3 @@ /** | ||
*/ | ||
toISOTime(ops?: ToISOTimeOptions): string; | ||
toISOTime(opts?: ToISOTimeOptions): string | IfInvalid<null>; | ||
@@ -1337,3 +1343,3 @@ /** | ||
*/ | ||
toRFC2822(): string; | ||
toRFC2822(): string | IfInvalid<null>; | ||
@@ -1350,3 +1356,3 @@ /** | ||
*/ | ||
toHTTP(): string; | ||
toHTTP(): string | IfInvalid<null>; | ||
@@ -1359,3 +1365,3 @@ /** | ||
*/ | ||
toSQLDate(): string; | ||
toSQLDate(): string | IfInvalid<null>; | ||
@@ -1374,3 +1380,3 @@ /** | ||
*/ | ||
toSQLTime(opts?: ToSQLOptions): string; | ||
toSQLTime(opts?: ToSQLOptions): string | IfInvalid<null>; | ||
@@ -1389,3 +1395,3 @@ /** | ||
*/ | ||
toSQL(opts?: ToSQLOptions): string; | ||
toSQL(opts?: ToSQLOptions): string | IfInvalid<null>; | ||
@@ -1395,3 +1401,3 @@ /** | ||
*/ | ||
toString(): string; | ||
toString(): string | IfInvalid<'Invalid DateTime'>; | ||
@@ -1401,3 +1407,3 @@ /** | ||
*/ | ||
valueOf(): number; | ||
valueOf(): number | IfInvalid<typeof NaN>; | ||
@@ -1407,3 +1413,3 @@ /** | ||
*/ | ||
toMillis(): number; | ||
toMillis(): number | IfInvalid<typeof NaN>; | ||
@@ -1413,3 +1419,3 @@ /** | ||
*/ | ||
toSeconds(): number; | ||
toSeconds(): number | IfInvalid<typeof NaN>; | ||
@@ -1419,3 +1425,3 @@ /** | ||
*/ | ||
toUnixInteger(): number; | ||
toUnixInteger(): number | IfInvalid<typeof NaN>; | ||
@@ -1425,3 +1431,3 @@ /** | ||
*/ | ||
toJSON(): string; | ||
toJSON(): string | IfInvalid<null>; | ||
@@ -1504,3 +1510,3 @@ /** | ||
*/ | ||
hasSame(otherDateTime: DateTime, unit: DateTimeUnit): boolean; | ||
hasSame(otherDateTime: DateTime, unit: DateTimeUnit): boolean | IfInvalid<false>; | ||
@@ -1514,3 +1520,3 @@ /** | ||
*/ | ||
equals(other: DateTime): boolean; | ||
equals(other: DateTime): boolean | IfInvalid<false>; | ||
@@ -1535,3 +1541,3 @@ /** | ||
*/ | ||
toRelative(options?: ToRelativeOptions): string | null; | ||
toRelative(options?: ToRelativeOptions): string | IfInvalid<null>; | ||
@@ -1551,3 +1557,3 @@ /** | ||
*/ | ||
toRelativeCalendar(options?: ToRelativeCalendarOptions): string | null; | ||
toRelativeCalendar(options?: ToRelativeCalendarOptions): string | IfInvalid<null>; | ||
@@ -1554,0 +1560,0 @@ /** |
import { NumberingSystem } from './misc'; | ||
import { ConversionAccuracy } from './datetime'; | ||
import { IfInvalid } from './_util'; | ||
@@ -198,3 +199,3 @@ export interface DurationOptions { | ||
*/ | ||
get locale(): string; | ||
get locale(): string | IfInvalid<null>; | ||
@@ -204,3 +205,3 @@ /** | ||
*/ | ||
get numberingSystem(): string; | ||
get numberingSystem(): string | IfInvalid<null>; | ||
@@ -231,3 +232,3 @@ /** | ||
*/ | ||
toFormat(fmt: string, opts?: { floor?: boolean | undefined }): string; | ||
toFormat(fmt: string, opts?: { floor?: boolean | undefined }): string | IfInvalid<'Invalid Duration'>; | ||
@@ -271,3 +272,3 @@ /** | ||
*/ | ||
toISO(): string; | ||
toISO(): string | IfInvalid<null>; | ||
@@ -295,3 +296,3 @@ /** | ||
*/ | ||
toISOTime(opts?: ToISOTimeDurationOptions): string; | ||
toISOTime(opts?: ToISOTimeDurationOptions): string | IfInvalid<null>; | ||
@@ -301,3 +302,3 @@ /** | ||
*/ | ||
toJSON(): string; | ||
toJSON(): string | IfInvalid<null>; | ||
@@ -307,3 +308,3 @@ /** | ||
*/ | ||
toString(): string; | ||
toString(): string | IfInvalid<null>; | ||
@@ -313,3 +314,3 @@ /** | ||
*/ | ||
toMillis(): number; | ||
toMillis(): number | IfInvalid<typeof NaN>; | ||
@@ -319,3 +320,3 @@ /** | ||
*/ | ||
valueOf(): number; | ||
valueOf(): number | IfInvalid<typeof NaN>; | ||
@@ -358,3 +359,3 @@ /** | ||
*/ | ||
get(unit: DurationUnit): number; | ||
get(unit: DurationUnit): number | IfInvalid<typeof NaN>; | ||
@@ -393,3 +394,3 @@ /** | ||
*/ | ||
as(unit: DurationUnit): number; | ||
as(unit: DurationUnit): number | IfInvalid<typeof NaN>; | ||
@@ -439,3 +440,3 @@ /** | ||
*/ | ||
get years(): number; | ||
get years(): number | IfInvalid<typeof NaN>; | ||
@@ -445,3 +446,3 @@ /** | ||
*/ | ||
get quarters(): number; | ||
get quarters(): number | IfInvalid<typeof NaN>; | ||
@@ -451,3 +452,3 @@ /** | ||
*/ | ||
get months(): number; | ||
get months(): number | IfInvalid<typeof NaN>; | ||
@@ -457,3 +458,3 @@ /** | ||
*/ | ||
get weeks(): number; | ||
get weeks(): number | IfInvalid<typeof NaN>; | ||
@@ -463,3 +464,3 @@ /** | ||
*/ | ||
get days(): number; | ||
get days(): number | IfInvalid<typeof NaN>; | ||
@@ -469,3 +470,3 @@ /** | ||
*/ | ||
get hours(): number; | ||
get hours(): number | IfInvalid<typeof NaN>; | ||
@@ -475,3 +476,3 @@ /** | ||
*/ | ||
get minutes(): number; | ||
get minutes(): number | IfInvalid<typeof NaN>; | ||
@@ -481,3 +482,3 @@ /** | ||
*/ | ||
get seconds(): number; | ||
get seconds(): number | IfInvalid<typeof NaN>; | ||
@@ -487,3 +488,3 @@ /** | ||
*/ | ||
get milliseconds(): number; | ||
get milliseconds(): number | IfInvalid<typeof NaN>; | ||
@@ -510,3 +511,3 @@ /** | ||
*/ | ||
equals(other: Duration): boolean; | ||
equals(other: Duration): boolean | IfInvalid<false>; | ||
} |
import { DateObjectUnits, DateTime, DateTimeOptions, DiffOptions, LocaleOptions, ToISOTimeOptions } from './datetime'; | ||
import { Duration, DurationLike, DurationUnit } from './duration'; | ||
import { IfInvalid } from './_util'; | ||
@@ -83,3 +84,3 @@ export interface IntervalObject { | ||
*/ | ||
get start(): DateTime; | ||
get start(): DateTime | IfInvalid<null>; | ||
@@ -89,3 +90,3 @@ /** | ||
*/ | ||
get end(): DateTime; | ||
get end(): DateTime | IfInvalid<null>; | ||
@@ -112,3 +113,3 @@ /** | ||
*/ | ||
length(unit?: DurationUnit): number; | ||
length(unit?: DurationUnit): number | IfInvalid<typeof NaN>; | ||
@@ -122,3 +123,3 @@ /** | ||
*/ | ||
count(unit?: DurationUnit): number; | ||
count(unit?: DurationUnit): number | IfInvalid<typeof NaN>; | ||
@@ -130,3 +131,3 @@ /** | ||
*/ | ||
hasSame(unit: DurationUnit): boolean; | ||
hasSame(unit: DurationUnit): boolean | IfInvalid<false>; | ||
@@ -143,3 +144,3 @@ /** | ||
*/ | ||
isAfter(dateTime: DateTime): boolean; | ||
isAfter(dateTime: DateTime): boolean | IfInvalid<false>; | ||
@@ -151,3 +152,3 @@ /** | ||
*/ | ||
isBefore(dateTime: DateTime): boolean; | ||
isBefore(dateTime: DateTime): boolean | IfInvalid<false>; | ||
@@ -159,3 +160,3 @@ /** | ||
*/ | ||
contains(dateTime: DateTime): boolean; | ||
contains(dateTime: DateTime): boolean | IfInvalid<false>; | ||
@@ -176,3 +177,3 @@ /** | ||
*/ | ||
splitAt(...dateTimes: DateTime[]): Interval[]; | ||
splitAt(...dateTimes: DateTime[]): Interval[] | IfInvalid<[]>; | ||
@@ -185,3 +186,3 @@ /** | ||
*/ | ||
splitBy(duration: DurationLike): Interval[]; | ||
splitBy(duration: DurationLike): Interval[] | IfInvalid<[]>; | ||
@@ -193,3 +194,3 @@ /** | ||
*/ | ||
divideEqually(numberOfParts: number): Interval[]; | ||
divideEqually(numberOfParts: number): Interval[] | IfInvalid<[]>; | ||
@@ -204,3 +205,3 @@ /** | ||
*/ | ||
abutsStart(other: Interval): boolean; | ||
abutsStart(other: Interval): boolean | IfInvalid<false>; | ||
@@ -210,3 +211,3 @@ /** | ||
*/ | ||
abutsEnd(other: Interval): boolean; | ||
abutsEnd(other: Interval): boolean | IfInvalid<false>; | ||
@@ -216,3 +217,3 @@ /** | ||
*/ | ||
engulfs(other: Interval): boolean; | ||
engulfs(other: Interval): boolean | IfInvalid<false>; | ||
@@ -222,3 +223,3 @@ /** | ||
*/ | ||
equals(other: Interval): boolean; | ||
equals(other: Interval): boolean | IfInvalid<false>; | ||
@@ -239,3 +240,3 @@ /** | ||
/** | ||
* Merge an array of Intervals into a equivalent minimal set of Intervals. | ||
* Merge an array of Intervals into an equivalent minimal set of Intervals. | ||
* Combines overlapping and adjacent Intervals. | ||
@@ -258,3 +259,3 @@ */ | ||
*/ | ||
toString(): string; | ||
toString(): string | IfInvalid<'Invalid Interval'>; | ||
@@ -289,3 +290,3 @@ /** | ||
*/ | ||
toLocaleString(formatOpts?: Intl.DateTimeFormatOptions, opts?: LocaleOptions): string; | ||
toLocaleString(formatOpts?: Intl.DateTimeFormatOptions, opts?: LocaleOptions): string | IfInvalid<'Invalid Interval'>; | ||
@@ -298,3 +299,3 @@ /** | ||
*/ | ||
toISO(opts?: ToISOTimeOptions): string; | ||
toISO(opts?: ToISOTimeOptions): string | IfInvalid<'Invalid Interval'>; | ||
@@ -306,3 +307,3 @@ /** | ||
*/ | ||
toISODate(): string; | ||
toISODate(): string | IfInvalid<'Invalid Interval'>; | ||
@@ -316,3 +317,3 @@ /** | ||
*/ | ||
toISOTime(opts?: ToISOTimeOptions): string; | ||
toISOTime(opts?: ToISOTimeOptions): string | IfInvalid<'Invalid Interval'>; | ||
@@ -331,3 +332,3 @@ /** | ||
}, | ||
): string; | ||
): string | IfInvalid<'Invalid Interval'>; | ||
@@ -334,0 +335,0 @@ /** |
@@ -47,2 +47,11 @@ import { Zone } from './zone'; | ||
* Whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals | ||
* | ||
* If setting this to true, be sure to opt-out of Luxon's invalid return types. | ||
* @example | ||
* Settings.throwOnInvalid = true; | ||
* declare module 'luxon' { | ||
* interface TSSettings { | ||
* throwOnInvalid: true; | ||
* } | ||
* } | ||
*/ | ||
@@ -56,1 +65,9 @@ static throwOnInvalid: boolean; | ||
} | ||
/** | ||
* TS only settings. Consumers can declaration merge this interface to change TS options. | ||
* | ||
* @see Settings.throwOnInvalid | ||
*/ | ||
// tslint:disable-next-line:no-empty-interface | ||
export interface TSSettings {} |
@@ -0,1 +1,3 @@ | ||
import { IfInvalid } from './_util'; | ||
export interface ZoneOffsetOptions { | ||
@@ -22,3 +24,3 @@ /** | ||
*/ | ||
get type(): string; | ||
get type(): string | IfInvalid<'invalid'>; | ||
@@ -33,3 +35,3 @@ /** | ||
*/ | ||
get isUniversal(): boolean; | ||
get isUniversal(): boolean | IfInvalid<false>; | ||
@@ -44,3 +46,3 @@ /** | ||
*/ | ||
offsetName(ts: number, options: ZoneOffsetOptions): string; | ||
offsetName(ts: number, options: ZoneOffsetOptions): string | IfInvalid<null>; | ||
@@ -54,3 +56,3 @@ /** | ||
*/ | ||
formatOffset(ts: number, format: ZoneOffsetFormat): string; | ||
formatOffset(ts: number, format: ZoneOffsetFormat): string | IfInvalid<''>; | ||
@@ -62,3 +64,3 @@ /** | ||
*/ | ||
offset(ts: number): number; | ||
offset(ts: number): number | IfInvalid<typeof NaN>; | ||
@@ -70,3 +72,3 @@ /** | ||
*/ | ||
equals(other: Zone): boolean; | ||
equals(other: Zone): boolean | IfInvalid<false>; | ||
@@ -76,3 +78,3 @@ /** | ||
*/ | ||
get isValid(): boolean; | ||
get isValid(): boolean | IfInvalid<false>; | ||
} | ||
@@ -125,2 +127,4 @@ | ||
constructor(name: string); | ||
get isValid(): true; | ||
} | ||
@@ -157,2 +161,4 @@ | ||
static parseSpecifier(s: string): FixedOffsetZone; | ||
get isValid(): true; | ||
} | ||
@@ -163,3 +169,8 @@ | ||
*/ | ||
export class InvalidZone extends Zone {} | ||
export class InvalidZone extends Zone { | ||
get type(): 'invalid'; | ||
get isUniversal(): false; | ||
get offsetFormat(): ''; | ||
get isValid(): false; | ||
} | ||
@@ -174,2 +185,4 @@ /** | ||
static get instance(): SystemZone; | ||
get isValid(): true; | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
115216
13
2710