Skip to content

Commit

Permalink
fix: add type support for plural forms of units
Browse files Browse the repository at this point in the history
  • Loading branch information
javascripter committed Dec 27, 2020
1 parent 3dbd14c commit 676d09b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@ declare namespace dayjs {
export type OptionType = { locale?: string, format?: string, utc?: boolean } | string | string[]

type UnitTypeShort = 'd' | 'M' | 'y' | 'h' | 'm' | 's' | 'ms'
export type UnitType = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year' | 'date' | UnitTypeShort;

export type OpUnitType = UnitType | "week" | 'w';
export type QUnitType = UnitType | "quarter" | 'Q';
type UnitTypeLong = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year' | 'date'

type UnitTypeLongPlural = `${UnitTypeLong}s`
export type UnitType = UnitTypeLong | UnitTypeLongPlural | UnitTypeShort;

export type OpUnitType = UnitType | "week" | "weeks" | 'w';
export type QUnitType = UnitType | "quarter" | "quarters" | 'Q';

class Dayjs {
constructor (config?: ConfigType)
Expand Down

0 comments on commit 676d09b

Please sign in to comment.