-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
65 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,100 +1,106 @@ | ||
declare const dayjs: dayjs; | ||
export = dayjs; | ||
|
||
declare const dayjs: dayjs | ||
export default dayjs | ||
declare namespace dayjs { | ||
type ConfigType = string | number | Date | Dayjs | ||
|
||
export type ConfigType = string | number | Date | Dayjs | ||
type OptionType = { locale: string } | ||
|
||
export type OptionType = { locale: string } | ||
type UnitTypeShort = 'd' | 'M' | 'y' | 'h' | 'm' | 's' | 'ms' | ||
type UnitTypeSingular = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year' | 'date' | UnitTypeShort; | ||
type UnitTypePlural = 'milliseconds' | 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'months' | 'quarters' | 'years' | 'dates' | ||
type UnitType = UnitTypeSingular | UnitTypePlural | ||
|
||
export type UnitTypeShort = 'd' | 'M' | 'y' | 'h' | 'm' | 's' | 'ms' | ||
export type UnitTypeSingular = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year' | 'date' | UnitTypeShort; | ||
export type UnitTypePlural = 'milliseconds' | 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'months' | 'quarters' | 'years' | 'dates' | ||
export type UnitType = UnitTypeSingular | UnitTypePlural | ||
type OpUnitTypeShort = 'w' | ||
type OpUnitType = UnitType | "week" | OpUnitTypeShort; | ||
|
||
export type OpUnitTypeShort = 'w' | ||
export type OpUnitType = UnitType | "week" | OpUnitTypeShort; | ||
|
||
export type PluginFunc<TPlugin> = (option: ConfigType, d1: Dayjs, d2: Dayjs) => void | ||
|
||
export interface dayjs<TPlugin = {}> { | ||
(config?: ConfigType, option?: OptionType): {} extends TPlugin ? Dayjs : Dayjs & TPlugin | ||
type PluginFunc<TPlugin> = (option: ConfigType, d1: Dayjs, d2: Dayjs) => void | ||
} | ||
|
||
extend<UPlugin extends object>(plugin: PluginFunc<UPlugin>, option?: ConfigType): dayjs<TPlugin & UPlugin> | ||
locale(arg1: any, arg2?: any): string | ||
isDayjs(d: any): d is Dayjs | ||
unix(t: number): Dayjs | ||
interface dayjs<TPlugin = {}> { | ||
(config?: dayjs.ConfigType, option?: dayjs.OptionType): {} extends TPlugin | ||
? Dayjs | ||
: Dayjs & TPlugin; | ||
|
||
extend<UPlugin extends object>( | ||
plugin: dayjs.PluginFunc<UPlugin>, | ||
option?: dayjs.ConfigType | ||
): dayjs<TPlugin & UPlugin>; | ||
locale(arg1: any, arg2?: any): string; | ||
isDayjs(d: any): d is Dayjs; | ||
unix(t: number): Dayjs; | ||
} | ||
|
||
export interface DayjsObject { | ||
years: number | ||
months: number | ||
date: number | ||
hours: number | ||
minutes: number | ||
seconds: number | ||
milliseconds: number | ||
declare interface DayjsObject { | ||
years: number; | ||
months: number; | ||
date: number; | ||
hours: number; | ||
minutes: number; | ||
seconds: number; | ||
milliseconds: number; | ||
} | ||
|
||
export class Dayjs { | ||
constructor(config?: ConfigType) | ||
declare class Dayjs { | ||
constructor(config?: dayjs.ConfigType); | ||
|
||
clone(): Dayjs | ||
clone(): Dayjs; | ||
|
||
isValid(): boolean | ||
isValid(): boolean; | ||
|
||
year(): number | ||
year(): number; | ||
|
||
month(): number | ||
month(): number; | ||
|
||
date(): number | ||
date(): number; | ||
|
||
day(): number | ||
day(): number; | ||
|
||
hour(): number | ||
hour(): number; | ||
|
||
minute(): number | ||
minute(): number; | ||
|
||
second(): number | ||
second(): number; | ||
|
||
millisecond(): number | ||
millisecond(): number; | ||
|
||
set(unit: UnitType, value: number): Dayjs | ||
set(unit: dayjs.UnitType, value: number): Dayjs; | ||
|
||
add(value: number, unit: OpUnitType): Dayjs | ||
add(value: number, unit: dayjs.OpUnitType): Dayjs; | ||
|
||
subtract(value: number, unit: OpUnitType): Dayjs | ||
subtract(value: number, unit: dayjs.OpUnitType): Dayjs; | ||
|
||
startOf(unit: OpUnitType): Dayjs | ||
startOf(unit: dayjs.OpUnitType): Dayjs; | ||
|
||
endOf(unit: OpUnitType): Dayjs | ||
endOf(unit: dayjs.OpUnitType): Dayjs; | ||
|
||
format(template?: string): string | ||
format(template?: string): string; | ||
|
||
diff(dayjs: Dayjs, unit: OpUnitType, float?: boolean): number | ||
diff(dayjs: Dayjs, unit: dayjs.OpUnitType, float?: boolean): number; | ||
|
||
valueOf(): number | ||
valueOf(): number; | ||
|
||
unix(): number | ||
unix(): number; | ||
|
||
daysInMonth(): number | ||
daysInMonth(): number; | ||
|
||
toDate(): Date | ||
toDate(): Date; | ||
|
||
toArray(): number[] | ||
toArray(): number[]; | ||
|
||
toJSON(): string | ||
toJSON(): string; | ||
|
||
toISOString(): string | ||
toISOString(): string; | ||
|
||
toObject(): DayjsObject | ||
toObject(): DayjsObject; | ||
|
||
toString(): string | ||
toString(): string; | ||
|
||
isBefore(dayjs: Dayjs, unit?: OpUnitType): boolean | ||
isBefore(dayjs: Dayjs, unit?: dayjs.OpUnitType): boolean; | ||
|
||
isSame(dayjs: Dayjs, unit?: OpUnitType): boolean | ||
isSame(dayjs: Dayjs, unit?: dayjs.OpUnitType): boolean; | ||
|
||
isAfter(dayjs: Dayjs, unit?: OpUnitType): boolean | ||
isAfter(dayjs: Dayjs, unit?: dayjs.OpUnitType): boolean; | ||
|
||
locale(arg1: any, arg2?: any): Dayjs | ||
locale(arg1: any, arg2?: any): Dayjs; | ||
} |