mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-08 22:38:04 +08:00
34
types/luxon/index.d.ts
vendored
34
types/luxon/index.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
// Type definitions for luxon 0.5
|
||||
// Type definitions for luxon 1.2
|
||||
// Project: https://github.com/moment/luxon#readme
|
||||
// Definitions by: Colby DeHart <https://github.com/colbydehart>
|
||||
// Hyeonseok Yang <https://github.com/FourwingsY>
|
||||
@@ -180,14 +180,14 @@ declare module 'luxon' {
|
||||
zoneName: string;
|
||||
diff(
|
||||
other: DateTime,
|
||||
unit?: string | string[],
|
||||
unit?: DurationUnit | DurationUnit[],
|
||||
options?: DiffOptions
|
||||
): Duration;
|
||||
diffNow(unit?: string | string[], options?: DiffOptions): Duration;
|
||||
endOf(unit: string): DateTime;
|
||||
diffNow(unit?: DurationUnit | DurationUnit[], options?: DiffOptions): Duration;
|
||||
endOf(unit: DurationUnit): DateTime;
|
||||
equals(other: DateTime): boolean;
|
||||
get(unit: string): number;
|
||||
hasSame(other: DateTime, unit: string): boolean;
|
||||
get(unit: keyof DateTime): number;
|
||||
hasSame(other: DateTime, unit: DurationUnit): boolean;
|
||||
minus(duration: Duration | number | DurationObject): DateTime;
|
||||
plus(duration: Duration | number | DurationObject): DateTime;
|
||||
reconfigure(properties: LocaleOptions): DateTime;
|
||||
@@ -195,7 +195,8 @@ declare module 'luxon' {
|
||||
set(values: DateObjectUnits): DateTime;
|
||||
setLocale(locale: any): DateTime;
|
||||
setZone(zone: string | Zone, options?: ZoneOptions): DateTime;
|
||||
startOf(unit: string): DateTime;
|
||||
startOf(unit: DurationUnit): DateTime;
|
||||
toBSON(): Date;
|
||||
toFormat(format: string, options?: ToFormatOptions): string;
|
||||
toHTTP(): string;
|
||||
toISO(options?: ISOTimeOptions): string;
|
||||
@@ -207,6 +208,7 @@ declare module 'luxon' {
|
||||
toLocal(): DateTime;
|
||||
toLocaleParts(options?: DateTimeFormatOptions): any[];
|
||||
toLocaleString(options?: DateTimeFormatOptions): string;
|
||||
toMillis(): number;
|
||||
toObject(options?: { includeConfig?: boolean }): DateObject;
|
||||
toMillis(): number;
|
||||
toRFC2822(): string;
|
||||
@@ -238,6 +240,9 @@ declare module 'luxon' {
|
||||
|
||||
type DurationObject = DurationObjectUnits & DurationOptions;
|
||||
|
||||
type DurationUnit = 'year' | 'years' | 'quarter' | 'quarters' | 'month' | 'months' | 'week' | 'weeks' | 'day' | 'days'
|
||||
| 'hour' | 'hours' | 'minute' | 'minutes' | 'second' | 'seconds' | 'millisecond' | 'milliseconds';
|
||||
|
||||
class Duration {
|
||||
static fromISO(text: string, options?: DurationOptions): Duration;
|
||||
static fromMillis(
|
||||
@@ -261,16 +266,16 @@ declare module 'luxon' {
|
||||
seconds: number;
|
||||
weeks: number;
|
||||
years: number;
|
||||
as(unit: string): number;
|
||||
as(unit: DurationUnit): number;
|
||||
equals(other: Duration): boolean;
|
||||
get(unit: string): number;
|
||||
get(unit: DurationUnit): number;
|
||||
minus(duration: Duration | number | DurationObject): Duration;
|
||||
negate(): Duration;
|
||||
normalize(): Duration;
|
||||
plus(duration: Duration | number | DurationObject): Duration;
|
||||
reconfigure(objectPattern: DurationOptions): Duration;
|
||||
set(values: DurationObjectUnits): Duration;
|
||||
shiftTo(...units: string[]): Duration;
|
||||
shiftTo(...units: DurationUnit[]): Duration;
|
||||
toFormat(format: string, options?: ToFormatOptions): string;
|
||||
toISO(): string;
|
||||
toJSON(): string;
|
||||
@@ -278,6 +283,7 @@ declare module 'luxon' {
|
||||
includeConfig?: boolean;
|
||||
}): DurationObject;
|
||||
toString(): string;
|
||||
valueOf(): number;
|
||||
}
|
||||
|
||||
type EraLength = 'short' | 'long';
|
||||
@@ -341,23 +347,23 @@ declare module 'luxon' {
|
||||
abutsEnd(other: Interval): boolean;
|
||||
abutsStart(other: Interval): boolean;
|
||||
contains(dateTime: DateTime): boolean;
|
||||
count(unit?: string): number;
|
||||
count(unit?: DurationUnit): number;
|
||||
difference(...intervals: Interval[]): Interval[];
|
||||
divideEqually(numberOfParts?: number): Interval[];
|
||||
engulfs(other: Interval): boolean;
|
||||
equals(other: Interval): boolean;
|
||||
hasSame(unit: string): boolean;
|
||||
hasSame(unit: DurationUnit): boolean;
|
||||
intersection(other: Interval): Interval;
|
||||
isAfter(dateTime: DateTime): boolean;
|
||||
isBefore(dateTime: DateTime): boolean;
|
||||
isEmpty(): boolean;
|
||||
length(unit?: string): number;
|
||||
length(unit?: DurationUnit): number;
|
||||
overlaps(other: Interval): boolean;
|
||||
set(values: IntervalObject): Interval;
|
||||
splitAt(...dateTimes: DateTime[]): Interval[];
|
||||
splitBy(duration: Duration | DurationObject | number): Interval[];
|
||||
toDuration(
|
||||
unit: string | string[],
|
||||
unit: DurationUnit | DurationUnit[],
|
||||
options?: DiffOptions
|
||||
): Duration;
|
||||
toFormat(
|
||||
|
||||
Reference in New Issue
Block a user