dayjs
Advanced tools
Comparing version 2.0.0-alpha.3 to 2.0.0-alpha.4
/// <reference path="./locale/index.d.ts" /> | ||
export = dayjs; | ||
export interface ConfigTypeMap { | ||
default: string | number | Date | Dayjs | null | undefined | ||
} | ||
declare function dayjs (date?: dayjs.ConfigType): dayjs.Dayjs | ||
export type ConfigType = ConfigTypeMap[keyof ConfigTypeMap] | ||
declare function dayjs (date?: dayjs.ConfigType, format?: dayjs.OptionType, strict?: boolean): dayjs.Dayjs | ||
export interface FormatObject { | ||
locale?: string | ||
format?: string | ||
utc?: boolean | ||
} | ||
declare function dayjs (date?: dayjs.ConfigType, format?: dayjs.OptionType, locale?: string, strict?: boolean): dayjs.Dayjs | ||
export type OptionType = FormatObject | string | string[] | ||
declare namespace dayjs { | ||
interface ConfigTypeMap { | ||
default: string | number | Date | Dayjs | null | undefined | ||
} | ||
export type UnitTypeShort = 'd' | 'D' | 'M' | 'y' | 'h' | 'm' | 's' | 'ms' | ||
export type ConfigType = ConfigTypeMap[keyof ConfigTypeMap] | ||
export type UnitTypeLong = | ||
| 'millisecond' | ||
| 'second' | ||
| 'minute' | ||
| 'hour' | ||
| 'day' | ||
| 'month' | ||
| 'year' | ||
| 'date' | ||
export interface FormatObject { locale?: string, format?: string, utc?: boolean } | ||
export type UnitTypeLongPlural = | ||
| 'milliseconds' | ||
| 'seconds' | ||
| 'minutes' | ||
| 'hours' | ||
| 'days' | ||
| 'months' | ||
| 'years' | ||
| 'dates' | ||
export type OptionType = FormatObject | string | string[] | ||
export type UnitType = UnitTypeLong | UnitTypeLongPlural | UnitTypeShort | ||
export type UnitTypeShort = 'd' | 'D' | 'M' | 'y' | 'h' | 'm' | 's' | 'ms' | ||
export type OpUnitType = UnitType | 'week' | 'weeks' | 'w' | ||
export type QUnitType = UnitType | 'quarter' | 'quarters' | 'Q' | ||
export type ManipulateType = Exclude<OpUnitType, 'date' | 'dates'> | ||
export declare interface Dayjs { | ||
constructor(config?: ConfigType) | ||
/** | ||
* All Day.js objects are immutable. Still, `dayjs#clone` can create a clone of the current object if you need one. | ||
* ``` | ||
* dayjs().clone()// => Dayjs | ||
* dayjs(dayjs('2019-01-25')) // passing a Dayjs object to a constructor will also clone it | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/parse/dayjs-clone | ||
*/ | ||
clone(): Dayjs | ||
/** | ||
* This returns a `boolean` indicating whether the Day.js object contains a valid date or not. | ||
* ``` | ||
* dayjs().isValid()// => boolean | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/parse/is-valid | ||
*/ | ||
isValid(): boolean | ||
/** | ||
* Get the year. | ||
* ``` | ||
* dayjs().year()// => 2020 | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/year | ||
*/ | ||
year(): number | ||
/** | ||
* Set the year. | ||
* ``` | ||
* dayjs().year(2000)// => Dayjs | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/year | ||
*/ | ||
year(value: number): Dayjs | ||
/** | ||
* Get the month. | ||
* | ||
* Months are zero indexed, so January is month 0. | ||
* ``` | ||
* dayjs().month()// => 0-11 | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/month | ||
*/ | ||
month(): number | ||
/** | ||
* Set the month. | ||
* | ||
* Months are zero indexed, so January is month 0. | ||
* | ||
* Accepts numbers from 0 to 11. If the range is exceeded, it will bubble up to the next year. | ||
* ``` | ||
* dayjs().month(0)// => Dayjs | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/month | ||
*/ | ||
month(value: number): Dayjs | ||
/** | ||
* Get the date of the month. | ||
* ``` | ||
* dayjs().date()// => 1-31 | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/date | ||
*/ | ||
date(): number | ||
/** | ||
* Set the date of the month. | ||
* | ||
* Accepts numbers from 1 to 31. If the range is exceeded, it will bubble up to the next months. | ||
* ``` | ||
* dayjs().date(1)// => Dayjs | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/date | ||
*/ | ||
date(value: number): Dayjs | ||
/** | ||
* Get the day of the week. | ||
* | ||
* Returns numbers from 0 (Sunday) to 6 (Saturday). | ||
* ``` | ||
* dayjs().day()// 0-6 | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/day | ||
*/ | ||
day(): number | ||
/** | ||
* Set the day of the week. | ||
* | ||
* Accepts numbers from 0 (Sunday) to 6 (Saturday). If the range is exceeded, it will bubble up to next weeks. | ||
* ``` | ||
* dayjs().day(0)// => Dayjs | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/day | ||
*/ | ||
day(value: number): Dayjs | ||
/** | ||
* Get the hour. | ||
* ``` | ||
* dayjs().hour()// => 0-23 | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/hour | ||
*/ | ||
hour(): number | ||
/** | ||
* Set the hour. | ||
* | ||
* Accepts numbers from 0 to 23. If the range is exceeded, it will bubble up to the next day. | ||
* ``` | ||
* dayjs().hour(12)// => Dayjs | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/hour | ||
*/ | ||
hour(value: number): Dayjs | ||
/** | ||
* Get the minutes. | ||
* ``` | ||
* dayjs().minute()// => 0-59 | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/minute | ||
*/ | ||
minute(): number | ||
/** | ||
* Set the minutes. | ||
* | ||
* Accepts numbers from 0 to 59. If the range is exceeded, it will bubble up to the next hour. | ||
* ``` | ||
* dayjs().minute(59)// => Dayjs | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/minute | ||
*/ | ||
minute(value: number): Dayjs | ||
/** | ||
* Get the seconds. | ||
* ``` | ||
* dayjs().second()// => 0-59 | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/second | ||
*/ | ||
second(): number | ||
/** | ||
* Set the seconds. | ||
* | ||
* Accepts numbers from 0 to 59. If the range is exceeded, it will bubble up to the next minutes. | ||
* ``` | ||
* dayjs().second(1)// Dayjs | ||
* ``` | ||
*/ | ||
second(value: number): Dayjs | ||
/** | ||
* Get the milliseconds. | ||
* ``` | ||
* dayjs().millisecond()// => 0-999 | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/millisecond | ||
*/ | ||
millisecond(): number | ||
/** | ||
* Set the milliseconds. | ||
* | ||
* Accepts numbers from 0 to 999. If the range is exceeded, it will bubble up to the next seconds. | ||
* ``` | ||
* dayjs().millisecond(1)// => Dayjs | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/millisecond | ||
*/ | ||
millisecond(value: number): Dayjs | ||
/** | ||
* Generic setter, accepting unit as first argument, and value as second, returns a new instance with the applied changes. | ||
* | ||
* In general: | ||
* ``` | ||
* dayjs().set(unit, value) === dayjs()[unit](value) | ||
* ``` | ||
* Units are case insensitive, and support plural and short forms. | ||
* ``` | ||
* dayjs().set('date', 1) | ||
* dayjs().set('month', 3) // April | ||
* dayjs().set('second', 30) | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/set | ||
*/ | ||
set(unit: UnitType, value: number): Dayjs | ||
/** | ||
* String getter, returns the corresponding information getting from Day.js object. | ||
* | ||
* In general: | ||
* ``` | ||
* dayjs().get(unit) === dayjs()[unit]() | ||
* ``` | ||
* Units are case insensitive, and support plural and short forms. | ||
* ``` | ||
* dayjs().get('year') | ||
* dayjs().get('month') // start 0 | ||
* dayjs().get('date') | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/get | ||
*/ | ||
get(unit: UnitType): number | ||
/** | ||
* Returns a cloned Day.js object with a specified amount of time added. | ||
* ``` | ||
* dayjs().add(7, 'day')// => Dayjs | ||
* ``` | ||
* Units are case insensitive, and support plural and short forms. | ||
* | ||
* Docs: https://day.js.org/docs/en/manipulate/add | ||
*/ | ||
add(value: number, unit?: ManipulateType): Dayjs | ||
/** | ||
* Returns a cloned Day.js object with a specified amount of time subtracted. | ||
* ``` | ||
* dayjs().subtract(7, 'year')// => Dayjs | ||
* ``` | ||
* Units are case insensitive, and support plural and short forms. | ||
* | ||
* Docs: https://day.js.org/docs/en/manipulate/subtract | ||
*/ | ||
subtract(value: number, unit?: ManipulateType): Dayjs | ||
/** | ||
* Returns a cloned Day.js object and set it to the start of a unit of time. | ||
* ``` | ||
* dayjs().startOf('year')// => Dayjs | ||
* ``` | ||
* Units are case insensitive, and support plural and short forms. | ||
* | ||
* Docs: https://day.js.org/docs/en/manipulate/start-of | ||
*/ | ||
startOf(unit: OpUnitType): Dayjs | ||
/** | ||
* Returns a cloned Day.js object and set it to the end of a unit of time. | ||
* ``` | ||
* dayjs().endOf('month')// => Dayjs | ||
* ``` | ||
* Units are case insensitive, and support plural and short forms. | ||
* | ||
* Docs: https://day.js.org/docs/en/manipulate/end-of | ||
*/ | ||
endOf(unit: OpUnitType): Dayjs | ||
/** | ||
* Get the formatted date according to the string of tokens passed in. | ||
* | ||
* To escape characters, wrap them in square brackets (e.g. [MM]). | ||
* ``` | ||
* dayjs().format()// => current date in ISO8601, without fraction seconds e.g. '2020-04-02T08:02:17-05:00' | ||
* dayjs('2019-01-25').format('[YYYYescape] YYYY-MM-DDTHH:mm:ssZ[Z]')// 'YYYYescape 2019-01-25T00:00:00-02:00Z' | ||
* dayjs('2019-01-25').format('DD/MM/YYYY') // '25/01/2019' | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/display/format | ||
*/ | ||
format(template?: string): string | ||
/** | ||
* This indicates the difference between two date-time in the specified unit. | ||
* | ||
* To get the difference in milliseconds, use `dayjs#diff` | ||
* ``` | ||
* const date1 = dayjs('2019-01-25') | ||
* const date2 = dayjs('2018-06-05') | ||
* date1.diff(date2) // 20214000000 default milliseconds | ||
* date1.diff() // milliseconds to current time | ||
* ``` | ||
* | ||
* To get the difference in another unit of measurement, pass that measurement as the second argument. | ||
* ``` | ||
* const date1 = dayjs('2019-01-25') | ||
* date1.diff('2018-06-05', 'month') // 7 | ||
* ``` | ||
* Units are case insensitive, and support plural and short forms. | ||
* | ||
* Docs: https://day.js.org/docs/en/display/difference | ||
*/ | ||
diff( | ||
date?: ConfigType, | ||
unit?: QUnitType | OpUnitType, | ||
float?: boolean | ||
): number | ||
/** | ||
* This returns the number of **milliseconds** since the Unix Epoch of the Day.js object. | ||
* ``` | ||
* dayjs('2019-01-25').valueOf() // 1548381600000 | ||
* +dayjs(1548381600000) // 1548381600000 | ||
* ``` | ||
* To get a Unix timestamp (the number of seconds since the epoch) from a Day.js object, you should use Unix Timestamp `dayjs#unix()`. | ||
* | ||
* Docs: https://day.js.org/docs/en/display/unix-timestamp-milliseconds | ||
*/ | ||
valueOf(): number | ||
/** | ||
* This returns the Unix timestamp (the number of **seconds** since the Unix Epoch) of the Day.js object. | ||
* ``` | ||
* dayjs('2019-01-25').unix() // 1548381600 | ||
* ``` | ||
* This value is floored to the nearest second, and does not include a milliseconds component. | ||
* | ||
* Docs: https://day.js.org/docs/en/display/unix-timestamp | ||
*/ | ||
unix(): number | ||
/** | ||
* Get the number of days in the current month. | ||
* ``` | ||
* dayjs('2019-01-25').daysInMonth() // 31 | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/display/days-in-month | ||
*/ | ||
daysInMonth(): number | ||
/** | ||
* To get a copy of the native `Date` object parsed from the Day.js object use `dayjs#toDate`. | ||
* ``` | ||
* dayjs('2019-01-25').toDate()// => Date | ||
* ``` | ||
*/ | ||
toDate(): Date | ||
/** | ||
* To serialize as an ISO 8601 string. | ||
* ``` | ||
* dayjs('2019-01-25').toJSON() // '2019-01-25T02:00:00.000Z' | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/display/as-json | ||
*/ | ||
toJSON(): string | ||
/** | ||
* To format as an ISO 8601 string. | ||
* ``` | ||
* dayjs('2019-01-25').toISOString() // '2019-01-25T02:00:00.000Z' | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/display/as-iso-string | ||
*/ | ||
toISOString(): string | ||
/** | ||
* Returns a string representation of the date. | ||
* ``` | ||
* dayjs('2019-01-25').toString() // 'Fri, 25 Jan 2019 02:00:00 GMT' | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/display/as-string | ||
*/ | ||
toString(): string | ||
/** | ||
* Get the UTC offset in minutes. | ||
* ``` | ||
* dayjs().utcOffset() | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/manipulate/utc-offset | ||
*/ | ||
utcOffset(): number | ||
/** | ||
* This indicates whether the Day.js object is before the other supplied date-time. | ||
* ``` | ||
* dayjs().isBefore(dayjs('2011-01-01')) // default milliseconds | ||
* ``` | ||
* If you want to limit the granularity to a unit other than milliseconds, pass it as the second parameter. | ||
* ``` | ||
* dayjs().isBefore('2011-01-01', 'year')// => boolean | ||
* ``` | ||
* Units are case insensitive, and support plural and short forms. | ||
* | ||
* Docs: https://day.js.org/docs/en/query/is-before | ||
*/ | ||
isBefore(date: ConfigType, unit?: OpUnitType): boolean | ||
/** | ||
* This indicates whether the Day.js object is the same as the other supplied date-time. | ||
* ``` | ||
* dayjs().isSame(dayjs('2011-01-01')) // default milliseconds | ||
* ``` | ||
* If you want to limit the granularity to a unit other than milliseconds, pass it as the second parameter. | ||
* ``` | ||
* dayjs().isSame('2011-01-01', 'year')// => boolean | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/query/is-same | ||
*/ | ||
isSame(date: ConfigType, unit?: OpUnitType): boolean | ||
/** | ||
* This indicates whether the Day.js object is after the other supplied date-time. | ||
* ``` | ||
* dayjs().isAfter(dayjs('2011-01-01')) // default milliseconds | ||
* ``` | ||
* If you want to limit the granularity to a unit other than milliseconds, pass it as the second parameter. | ||
* ``` | ||
* dayjs().isAfter('2011-01-01', 'year')// => boolean | ||
* ``` | ||
* Units are case insensitive, and support plural and short forms. | ||
* | ||
* Docs: https://day.js.org/docs/en/query/is-after | ||
*/ | ||
isAfter(date: ConfigType, unit?: OpUnitType): boolean | ||
export type UnitTypeLong = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year' | 'date' | ||
locale(): string | ||
export type UnitTypeLongPlural = 'milliseconds' | 'seconds' | 'minutes' | 'hours' | 'days' | 'months' | 'years' | 'dates' | ||
export type UnitType = UnitTypeLong | UnitTypeLongPlural | UnitTypeShort; | ||
locale(preset: string | Locale, object?: Partial<Locale>): Dayjs | ||
} | ||
export type OpUnitType = UnitType | "week" | "weeks" | 'w'; | ||
export type QUnitType = UnitType | "quarter" | "quarters" | 'Q'; | ||
export type ManipulateType = Exclude<OpUnitType, 'date' | 'dates'>; | ||
class Dayjs { | ||
constructor (config?: ConfigType) | ||
/** | ||
* All Day.js objects are immutable. Still, `dayjs#clone` can create a clone of the current object if you need one. | ||
* ``` | ||
* dayjs().clone()// => Dayjs | ||
* dayjs(dayjs('2019-01-25')) // passing a Dayjs object to a constructor will also clone it | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/parse/dayjs-clone | ||
*/ | ||
clone(): Dayjs | ||
/** | ||
* This returns a `boolean` indicating whether the Day.js object contains a valid date or not. | ||
* ``` | ||
* dayjs().isValid()// => boolean | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/parse/is-valid | ||
*/ | ||
isValid(): boolean | ||
/** | ||
* Get the year. | ||
* ``` | ||
* dayjs().year()// => 2020 | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/year | ||
*/ | ||
year(): number | ||
/** | ||
* Set the year. | ||
* ``` | ||
* dayjs().year(2000)// => Dayjs | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/year | ||
*/ | ||
year(value: number): Dayjs | ||
/** | ||
* Get the month. | ||
* | ||
* Months are zero indexed, so January is month 0. | ||
* ``` | ||
* dayjs().month()// => 0-11 | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/month | ||
*/ | ||
month(): number | ||
/** | ||
* Set the month. | ||
* | ||
* Months are zero indexed, so January is month 0. | ||
* | ||
* Accepts numbers from 0 to 11. If the range is exceeded, it will bubble up to the next year. | ||
* ``` | ||
* dayjs().month(0)// => Dayjs | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/month | ||
*/ | ||
month(value: number): Dayjs | ||
/** | ||
* Get the date of the month. | ||
* ``` | ||
* dayjs().date()// => 1-31 | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/date | ||
*/ | ||
date(): number | ||
/** | ||
* Set the date of the month. | ||
* | ||
* Accepts numbers from 1 to 31. If the range is exceeded, it will bubble up to the next months. | ||
* ``` | ||
* dayjs().date(1)// => Dayjs | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/date | ||
*/ | ||
date(value: number): Dayjs | ||
/** | ||
* Get the day of the week. | ||
* | ||
* Returns numbers from 0 (Sunday) to 6 (Saturday). | ||
* ``` | ||
* dayjs().day()// 0-6 | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/day | ||
*/ | ||
day(): number | ||
/** | ||
* Set the day of the week. | ||
* | ||
* Accepts numbers from 0 (Sunday) to 6 (Saturday). If the range is exceeded, it will bubble up to next weeks. | ||
* ``` | ||
* dayjs().day(0)// => Dayjs | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/day | ||
*/ | ||
day(value: number): Dayjs | ||
/** | ||
* Get the hour. | ||
* ``` | ||
* dayjs().hour()// => 0-23 | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/hour | ||
*/ | ||
hour(): number | ||
/** | ||
* Set the hour. | ||
* | ||
* Accepts numbers from 0 to 23. If the range is exceeded, it will bubble up to the next day. | ||
* ``` | ||
* dayjs().hour(12)// => Dayjs | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/hour | ||
*/ | ||
hour(value: number): Dayjs | ||
/** | ||
* Get the minutes. | ||
* ``` | ||
* dayjs().minute()// => 0-59 | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/minute | ||
*/ | ||
minute(): number | ||
/** | ||
* Set the minutes. | ||
* | ||
* Accepts numbers from 0 to 59. If the range is exceeded, it will bubble up to the next hour. | ||
* ``` | ||
* dayjs().minute(59)// => Dayjs | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/minute | ||
*/ | ||
minute(value: number): Dayjs | ||
/** | ||
* Get the seconds. | ||
* ``` | ||
* dayjs().second()// => 0-59 | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/second | ||
*/ | ||
second(): number | ||
/** | ||
* Set the seconds. | ||
* | ||
* Accepts numbers from 0 to 59. If the range is exceeded, it will bubble up to the next minutes. | ||
* ``` | ||
* dayjs().second(1)// Dayjs | ||
* ``` | ||
*/ | ||
second(value: number): Dayjs | ||
/** | ||
* Get the milliseconds. | ||
* ``` | ||
* dayjs().millisecond()// => 0-999 | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/millisecond | ||
*/ | ||
millisecond(): number | ||
/** | ||
* Set the milliseconds. | ||
* | ||
* Accepts numbers from 0 to 999. If the range is exceeded, it will bubble up to the next seconds. | ||
* ``` | ||
* dayjs().millisecond(1)// => Dayjs | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/millisecond | ||
*/ | ||
millisecond(value: number): Dayjs | ||
/** | ||
* Generic setter, accepting unit as first argument, and value as second, returns a new instance with the applied changes. | ||
* | ||
* In general: | ||
* ``` | ||
* dayjs().set(unit, value) === dayjs()[unit](value) | ||
* ``` | ||
* Units are case insensitive, and support plural and short forms. | ||
* ``` | ||
* dayjs().set('date', 1) | ||
* dayjs().set('month', 3) // April | ||
* dayjs().set('second', 30) | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/set | ||
*/ | ||
set(unit: UnitType, value: number): Dayjs | ||
/** | ||
* String getter, returns the corresponding information getting from Day.js object. | ||
* | ||
* In general: | ||
* ``` | ||
* dayjs().get(unit) === dayjs()[unit]() | ||
* ``` | ||
* Units are case insensitive, and support plural and short forms. | ||
* ``` | ||
* dayjs().get('year') | ||
* dayjs().get('month') // start 0 | ||
* dayjs().get('date') | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/get-set/get | ||
*/ | ||
get(unit: UnitType): number | ||
/** | ||
* Returns a cloned Day.js object with a specified amount of time added. | ||
* ``` | ||
* dayjs().add(7, 'day')// => Dayjs | ||
* ``` | ||
* Units are case insensitive, and support plural and short forms. | ||
* | ||
* Docs: https://day.js.org/docs/en/manipulate/add | ||
*/ | ||
add(value: number, unit?: ManipulateType): Dayjs | ||
/** | ||
* Returns a cloned Day.js object with a specified amount of time subtracted. | ||
* ``` | ||
* dayjs().subtract(7, 'year')// => Dayjs | ||
* ``` | ||
* Units are case insensitive, and support plural and short forms. | ||
* | ||
* Docs: https://day.js.org/docs/en/manipulate/subtract | ||
*/ | ||
subtract(value: number, unit?: ManipulateType): Dayjs | ||
/** | ||
* Returns a cloned Day.js object and set it to the start of a unit of time. | ||
* ``` | ||
* dayjs().startOf('year')// => Dayjs | ||
* ``` | ||
* Units are case insensitive, and support plural and short forms. | ||
* | ||
* Docs: https://day.js.org/docs/en/manipulate/start-of | ||
*/ | ||
startOf(unit: OpUnitType): Dayjs | ||
/** | ||
* Returns a cloned Day.js object and set it to the end of a unit of time. | ||
* ``` | ||
* dayjs().endOf('month')// => Dayjs | ||
* ``` | ||
* Units are case insensitive, and support plural and short forms. | ||
* | ||
* Docs: https://day.js.org/docs/en/manipulate/end-of | ||
*/ | ||
endOf(unit: OpUnitType): Dayjs | ||
/** | ||
* Get the formatted date according to the string of tokens passed in. | ||
* | ||
* To escape characters, wrap them in square brackets (e.g. [MM]). | ||
* ``` | ||
* dayjs().format()// => current date in ISO8601, without fraction seconds e.g. '2020-04-02T08:02:17-05:00' | ||
* dayjs('2019-01-25').format('[YYYYescape] YYYY-MM-DDTHH:mm:ssZ[Z]')// 'YYYYescape 2019-01-25T00:00:00-02:00Z' | ||
* dayjs('2019-01-25').format('DD/MM/YYYY') // '25/01/2019' | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/display/format | ||
*/ | ||
format(template?: string): string | ||
/** | ||
* This indicates the difference between two date-time in the specified unit. | ||
* | ||
* To get the difference in milliseconds, use `dayjs#diff` | ||
* ``` | ||
* const date1 = dayjs('2019-01-25') | ||
* const date2 = dayjs('2018-06-05') | ||
* date1.diff(date2) // 20214000000 default milliseconds | ||
* date1.diff() // milliseconds to current time | ||
* ``` | ||
* | ||
* To get the difference in another unit of measurement, pass that measurement as the second argument. | ||
* ``` | ||
* const date1 = dayjs('2019-01-25') | ||
* date1.diff('2018-06-05', 'month') // 7 | ||
* ``` | ||
* Units are case insensitive, and support plural and short forms. | ||
* | ||
* Docs: https://day.js.org/docs/en/display/difference | ||
*/ | ||
diff(date?: ConfigType, unit?: QUnitType | OpUnitType, float?: boolean): number | ||
/** | ||
* This returns the number of **milliseconds** since the Unix Epoch of the Day.js object. | ||
* ``` | ||
* dayjs('2019-01-25').valueOf() // 1548381600000 | ||
* +dayjs(1548381600000) // 1548381600000 | ||
* ``` | ||
* To get a Unix timestamp (the number of seconds since the epoch) from a Day.js object, you should use Unix Timestamp `dayjs#unix()`. | ||
* | ||
* Docs: https://day.js.org/docs/en/display/unix-timestamp-milliseconds | ||
*/ | ||
valueOf(): number | ||
/** | ||
* This returns the Unix timestamp (the number of **seconds** since the Unix Epoch) of the Day.js object. | ||
* ``` | ||
* dayjs('2019-01-25').unix() // 1548381600 | ||
* ``` | ||
* This value is floored to the nearest second, and does not include a milliseconds component. | ||
* | ||
* Docs: https://day.js.org/docs/en/display/unix-timestamp | ||
*/ | ||
unix(): number | ||
/** | ||
* Get the number of days in the current month. | ||
* ``` | ||
* dayjs('2019-01-25').daysInMonth() // 31 | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/display/days-in-month | ||
*/ | ||
daysInMonth(): number | ||
/** | ||
* To get a copy of the native `Date` object parsed from the Day.js object use `dayjs#toDate`. | ||
* ``` | ||
* dayjs('2019-01-25').toDate()// => Date | ||
* ``` | ||
*/ | ||
toDate(): Date | ||
/** | ||
* To serialize as an ISO 8601 string. | ||
* ``` | ||
* dayjs('2019-01-25').toJSON() // '2019-01-25T02:00:00.000Z' | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/display/as-json | ||
*/ | ||
toJSON(): string | ||
/** | ||
* To format as an ISO 8601 string. | ||
* ``` | ||
* dayjs('2019-01-25').toISOString() // '2019-01-25T02:00:00.000Z' | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/display/as-iso-string | ||
*/ | ||
toISOString(): string | ||
/** | ||
* Returns a string representation of the date. | ||
* ``` | ||
* dayjs('2019-01-25').toString() // 'Fri, 25 Jan 2019 02:00:00 GMT' | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/display/as-string | ||
*/ | ||
toString(): string | ||
/** | ||
* Get the UTC offset in minutes. | ||
* ``` | ||
* dayjs().utcOffset() | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/manipulate/utc-offset | ||
*/ | ||
utcOffset(): number | ||
/** | ||
* This indicates whether the Day.js object is before the other supplied date-time. | ||
* ``` | ||
* dayjs().isBefore(dayjs('2011-01-01')) // default milliseconds | ||
* ``` | ||
* If you want to limit the granularity to a unit other than milliseconds, pass it as the second parameter. | ||
* ``` | ||
* dayjs().isBefore('2011-01-01', 'year')// => boolean | ||
* ``` | ||
* Units are case insensitive, and support plural and short forms. | ||
* | ||
* Docs: https://day.js.org/docs/en/query/is-before | ||
*/ | ||
isBefore(date: ConfigType, unit?: OpUnitType): boolean | ||
/** | ||
* This indicates whether the Day.js object is the same as the other supplied date-time. | ||
* ``` | ||
* dayjs().isSame(dayjs('2011-01-01')) // default milliseconds | ||
* ``` | ||
* If you want to limit the granularity to a unit other than milliseconds, pass it as the second parameter. | ||
* ``` | ||
* dayjs().isSame('2011-01-01', 'year')// => boolean | ||
* ``` | ||
* Docs: https://day.js.org/docs/en/query/is-same | ||
*/ | ||
isSame(date: ConfigType, unit?: OpUnitType): boolean | ||
/** | ||
* This indicates whether the Day.js object is after the other supplied date-time. | ||
* ``` | ||
* dayjs().isAfter(dayjs('2011-01-01')) // default milliseconds | ||
* ``` | ||
* If you want to limit the granularity to a unit other than milliseconds, pass it as the second parameter. | ||
* ``` | ||
* dayjs().isAfter('2011-01-01', 'year')// => boolean | ||
* ``` | ||
* Units are case insensitive, and support plural and short forms. | ||
* | ||
* Docs: https://day.js.org/docs/en/query/is-after | ||
*/ | ||
isAfter(date: ConfigType, unit?: OpUnitType): boolean | ||
export type PluginFunc<T = unknown> = (option: T, c: Dayjs, d: DayjsFn) => void | ||
locale(): string | ||
export interface DayjsFn { | ||
(date?: ConfigType): Dayjs | ||
(date?: ConfigType, format?: OptionType, strict?: boolean): Dayjs | ||
( | ||
date?: ConfigType, | ||
format?: OptionType, | ||
locale?: string, | ||
strict?: boolean | ||
): Dayjs | ||
locale(preset: string | ILocale, object?: Partial<ILocale>): Dayjs | ||
} | ||
extend: <T = unknown>(plugin: PluginFunc<T>, option?: T) => Dayjs | ||
locale: ( | ||
preset?: string | Locale, | ||
object?: Partial<Locale>, | ||
isLocal?: boolean | ||
) => string | ||
isDayjs: (d: any) => d is Dayjs | ||
unix: (t: number) => Dayjs | ||
} | ||
declare const dayjs: DayjsFn | ||
export type PluginFunc<T = unknown> = (option: T, c: typeof Dayjs, d: typeof dayjs) => void | ||
export function extend<T = unknown>(plugin: PluginFunc<T>, option?: T): Dayjs | ||
export function locale(preset?: string | ILocale, object?: Partial<ILocale>, isLocal?: boolean): string | ||
export function isDayjs(d: any): d is Dayjs | ||
export function unix(t: number): Dayjs | ||
const Ls : { [key: string] : ILocale } | ||
} | ||
export default dayjs |
@@ -1,1 +0,1 @@ | ||
[{"key":"af","name":"Afrikaans"},{"key":"ar-dz","name":"Arabic (Algeria)"},{"key":"am","name":"Amharic"},{"key":"ar-iq","name":" Arabic (Iraq)"},{"key":"ar-kw","name":"Arabic (Kuwait)"},{"key":"ar-ly","name":"Arabic (Lybia)"},{"key":"ar-ma","name":"Arabic (Morocco)"},{"key":"ar-sa","name":"Arabic (Saudi Arabia)"},{"key":"ar","name":"Arabic"},{"key":"az","name":"Azerbaijani"},{"key":"be","name":"Belarusian"},{"key":"bg","name":"Bulgarian"},{"key":"bi","name":"Bislama"},{"key":"bm","name":"Bambara"},{"key":"bn","name":"Bengali"},{"key":"bn-bd","name":"Bengali (Bangladesh)"},{"key":"bo","name":"Tibetan"},{"key":"br","name":"Breton"},{"key":"ca","name":"Catalan"},{"key":"bs","name":"Bosnian"},{"key":"cs","name":"Czech"},{"key":"ar-tn","name":" Arabic (Tunisia)"},{"key":"da","name":"Danish"},{"key":"de-at","name":"German (Austria)"},{"key":"de-ch","name":"German (Switzerland)"},{"key":"cy","name":"Welsh"},{"key":"de","name":"German"},{"key":"el","name":"Greek"},{"key":"dv","name":"Maldivian"},{"key":"en-au","name":"English (Australia)"},{"key":"en-ca","name":"English (Canada)"},{"key":"en-gb","name":"English (United Kingdom)"},{"key":"en-ie","name":"English (Ireland)"},{"key":"en-in","name":"English (India)"},{"key":"en-il","name":"English (Israel)"},{"key":"en-nz","name":"English (New Zealand)"},{"key":"en-sg","name":"English (Singapore)"},{"key":"en","name":"English"},{"key":"eo","name":"Esperanto"},{"key":"es-do","name":"Spanish (Dominican Republic)"},{"key":"es-mx","name":"Spanish (Mexico)"},{"key":"es-pr","name":"Spanish (Puerto Rico)"},{"key":"es-us","name":"Spanish (United States)"},{"key":"es","name":"Spanish"},{"key":"et","name":"Estonian"},{"key":"eu","name":"Basque"},{"key":"fa","name":"Persian"},{"key":"fo","name":"Faroese"},{"key":"fr-ca","name":"French (Canada)"},{"key":"fi","name":"Finnish"},{"key":"fr-ch","name":"French (Switzerland)"},{"key":"fr","name":"French"},{"key":"ga","name":"Irish or Irish Gaelic"},{"key":"fy","name":"Frisian"},{"key":"gd","name":"Scottish Gaelic"},{"key":"gl","name":"Galician"},{"key":"gom-latn","name":"Konkani Latin script"},{"key":"gu","name":"Gujarati"},{"key":"he","name":"Hebrew"},{"key":"hi","name":"Hindi"},{"key":"cv","name":"Chuvash"},{"key":"ht","name":"Haitian Creole (Haiti)"},{"key":"hr","name":"Croatian"},{"key":"id","name":"Indonesian"},{"key":"hy-am","name":"Armenian"},{"key":"hu","name":"Hungarian"},{"key":"is","name":"Icelandic"},{"key":"it-ch","name":"Italian (Switzerland)"},{"key":"it","name":"Italian"},{"key":"ka","name":"Georgian"},{"key":"en-tt","name":"English (Trinidad & Tobago)"},{"key":"kk","name":"Kazakh"},{"key":"kn","name":"Kannada"},{"key":"ko","name":"Korean"},{"key":"km","name":"Cambodian"},{"key":"ku","name":"Kurdish"},{"key":"ky","name":"Kyrgyz"},{"key":"lb","name":"Luxembourgish"},{"key":"lo","name":"Lao"},{"key":"lt","name":"Lithuanian"},{"key":"lv","name":"Latvian"},{"key":"me","name":"Montenegrin"},{"key":"mi","name":"Maori"},{"key":"mk","name":"Macedonian"},{"key":"ml","name":"Malayalam"},{"key":"mn","name":"Mongolian"},{"key":"mr","name":"Marathi"},{"key":"ms-my","name":"Malay"},{"key":"ms","name":"Malay"},{"key":"mt","name":"Maltese (Malta)"},{"key":"my","name":"Burmese"},{"key":"nb","name":"Norwegian Bokmål"},{"key":"nl-be","name":"Dutch (Belgium)"},{"key":"ne","name":"Nepalese"},{"key":"nl","name":"Dutch"},{"key":"nn","name":"Nynorsk"},{"key":"oc-lnc","name":"Occitan, lengadocian dialecte"},{"key":"pa-in","name":"Punjabi (India)"},{"key":"pl","name":"Polish"},{"key":"pt-br","name":"Portuguese (Brazil)"},{"key":"pt","name":"Portuguese"},{"key":"ro","name":"Romanian"},{"key":"ru","name":"Russian"},{"key":"rw","name":"Kinyarwanda (Rwanda)"},{"key":"sd","name":"Sindhi"},{"key":"se","name":"Northern Sami"},{"key":"si","name":"Sinhalese"},{"key":"sk","name":"Slovak"},{"key":"rn","name":"Kirundi"},{"key":"sl","name":"Slovenian"},{"key":"sq","name":"Albanian"},{"key":"sr-cyrl","name":"Serbian Cyrillic"},{"key":"sr","name":"Serbian"},{"key":"ss","name":"siSwati"},{"key":"sv-fi","name":"Finland Swedish"},{"key":"sv","name":"Swedish"},{"key":"sw","name":"Swahili"},{"key":"ta","name":"Tamil"},{"key":"te","name":"Telugu"},{"key":"tet","name":"Tetun Dili (East Timor)"},{"key":"tg","name":"Tajik"},{"key":"th","name":"Thai"},{"key":"tk","name":"Turkmen"},{"key":"tl-ph","name":"Tagalog (Philippines)"},{"key":"tr","name":"Turkish"},{"key":"tzl","name":"Talossan"},{"key":"tzm-latn","name":"Central Atlas Tamazight Latin"},{"key":"tlh","name":"Klingon"},{"key":"tzm","name":"Central Atlas Tamazight"},{"key":"uk","name":"Ukrainian"},{"key":"ur","name":"Urdu"},{"key":"ug-cn","name":"Uyghur (China)"},{"key":"uz-latn","name":"Uzbek Latin"},{"key":"vi","name":"Vietnamese"},{"key":"x-pseudo","name":"Pseudo"},{"key":"uz","name":"Uzbek"},{"key":"yo","name":"Yoruba Nigeria"},{"key":"zh-cn","name":"Chinese (China)"},{"key":"zh-tw","name":"Chinese (Taiwan)"},{"key":"zh-hk","name":"Chinese (Hong Kong)"},{"key":"zh","name":"Chinese"},{"key":"ja","name":"Japanese"},{"key":"jv","name":"Javanese"}] | ||
[{"key":"af","name":"Afrikaans"},{"key":"am","name":"Amharic"},{"key":"ar-dz","name":"Arabic (Algeria)"},{"key":"ar-iq","name":" Arabic (Iraq)"},{"key":"ar-kw","name":"Arabic (Kuwait)"},{"key":"ar-ly","name":"Arabic (Lybia)"},{"key":"ar-ma","name":"Arabic (Morocco)"},{"key":"ar-sa","name":"Arabic (Saudi Arabia)"},{"key":"ar","name":"Arabic"},{"key":"ar-tn","name":" Arabic (Tunisia)"},{"key":"be","name":"Belarusian"},{"key":"az","name":"Azerbaijani"},{"key":"bg","name":"Bulgarian"},{"key":"bi","name":"Bislama"},{"key":"bm","name":"Bambara"},{"key":"bn-bd","name":"Bengali (Bangladesh)"},{"key":"bn","name":"Bengali"},{"key":"bo","name":"Tibetan"},{"key":"br","name":"Breton"},{"key":"bs","name":"Bosnian"},{"key":"cs","name":"Czech"},{"key":"ca","name":"Catalan"},{"key":"cv","name":"Chuvash"},{"key":"cy","name":"Welsh"},{"key":"da","name":"Danish"},{"key":"de-at","name":"German (Austria)"},{"key":"de-ch","name":"German (Switzerland)"},{"key":"el","name":"Greek"},{"key":"de","name":"German"},{"key":"dv","name":"Maldivian"},{"key":"en-au","name":"English (Australia)"},{"key":"en-ca","name":"English (Canada)"},{"key":"en-gb","name":"English (United Kingdom)"},{"key":"en-il","name":"English (Israel)"},{"key":"en-ie","name":"English (Ireland)"},{"key":"en-in","name":"English (India)"},{"key":"en-sg","name":"English (Singapore)"},{"key":"en-nz","name":"English (New Zealand)"},{"key":"eo","name":"Esperanto"},{"key":"en","name":"English"},{"key":"es-do","name":"Spanish (Dominican Republic)"},{"key":"es-mx","name":"Spanish (Mexico)"},{"key":"es-pr","name":"Spanish (Puerto Rico)"},{"key":"es-us","name":"Spanish (United States)"},{"key":"et","name":"Estonian"},{"key":"eu","name":"Basque"},{"key":"es","name":"Spanish"},{"key":"fi","name":"Finnish"},{"key":"en-tt","name":"English (Trinidad & Tobago)"},{"key":"fo","name":"Faroese"},{"key":"fa","name":"Persian"},{"key":"fr-ca","name":"French (Canada)"},{"key":"fr","name":"French"},{"key":"fy","name":"Frisian"},{"key":"gl","name":"Galician"},{"key":"ga","name":"Irish or Irish Gaelic"},{"key":"gd","name":"Scottish Gaelic"},{"key":"he","name":"Hebrew"},{"key":"gu","name":"Gujarati"},{"key":"hi","name":"Hindi"},{"key":"gom-latn","name":"Konkani Latin script"},{"key":"ht","name":"Haitian Creole (Haiti)"},{"key":"hu","name":"Hungarian"},{"key":"hy-am","name":"Armenian"},{"key":"id","name":"Indonesian"},{"key":"fr-ch","name":"French (Switzerland)"},{"key":"is","name":"Icelandic"},{"key":"hr","name":"Croatian"},{"key":"it-ch","name":"Italian (Switzerland)"},{"key":"it","name":"Italian"},{"key":"jv","name":"Javanese"},{"key":"kk","name":"Kazakh"},{"key":"km","name":"Cambodian"},{"key":"ka","name":"Georgian"},{"key":"kn","name":"Kannada"},{"key":"ko","name":"Korean"},{"key":"ku","name":"Kurdish"},{"key":"ja","name":"Japanese"},{"key":"lb","name":"Luxembourgish"},{"key":"lo","name":"Lao"},{"key":"lv","name":"Latvian"},{"key":"me","name":"Montenegrin"},{"key":"mi","name":"Maori"},{"key":"mk","name":"Macedonian"},{"key":"ml","name":"Malayalam"},{"key":"mn","name":"Mongolian"},{"key":"mr","name":"Marathi"},{"key":"ms-my","name":"Malay"},{"key":"ky","name":"Kyrgyz"},{"key":"ms","name":"Malay"},{"key":"mt","name":"Maltese (Malta)"},{"key":"my","name":"Burmese"},{"key":"nb","name":"Norwegian Bokmål"},{"key":"ne","name":"Nepalese"},{"key":"nl-be","name":"Dutch (Belgium)"},{"key":"nl","name":"Dutch"},{"key":"nn","name":"Nynorsk"},{"key":"oc-lnc","name":"Occitan, lengadocian dialecte"},{"key":"pa-in","name":"Punjabi (India)"},{"key":"pl","name":"Polish"},{"key":"pt-br","name":"Portuguese (Brazil)"},{"key":"pt","name":"Portuguese"},{"key":"rn","name":"Kirundi"},{"key":"ro","name":"Romanian"},{"key":"rw","name":"Kinyarwanda (Rwanda)"},{"key":"sd","name":"Sindhi"},{"key":"ru","name":"Russian"},{"key":"se","name":"Northern Sami"},{"key":"si","name":"Sinhalese"},{"key":"sk","name":"Slovak"},{"key":"sl","name":"Slovenian"},{"key":"sq","name":"Albanian"},{"key":"sr-cyrl","name":"Serbian Cyrillic"},{"key":"sr","name":"Serbian"},{"key":"ss","name":"siSwati"},{"key":"sw","name":"Swahili"},{"key":"sv","name":"Swedish"},{"key":"sv-fi","name":"Finland Swedish"},{"key":"ta","name":"Tamil"},{"key":"te","name":"Telugu"},{"key":"tet","name":"Tetun Dili (East Timor)"},{"key":"tg","name":"Tajik"},{"key":"th","name":"Thai"},{"key":"tk","name":"Turkmen"},{"key":"tlh","name":"Klingon"},{"key":"tr","name":"Turkish"},{"key":"tzl","name":"Talossan"},{"key":"tl-ph","name":"Tagalog (Philippines)"},{"key":"ug-cn","name":"Uyghur (China)"},{"key":"tzm-latn","name":"Central Atlas Tamazight Latin"},{"key":"uk","name":"Ukrainian"},{"key":"tzm","name":"Central Atlas Tamazight"},{"key":"ur","name":"Urdu"},{"key":"uz-latn","name":"Uzbek Latin"},{"key":"uz","name":"Uzbek"},{"key":"vi","name":"Vietnamese"},{"key":"yo","name":"Yoruba Nigeria"},{"key":"zh-cn","name":"Chinese (China)"},{"key":"x-pseudo","name":"Pseudo"},{"key":"zh-hk","name":"Chinese (Hong Kong)"},{"key":"zh-tw","name":"Chinese (Taiwan)"},{"key":"zh","name":"Chinese"},{"key":"lt","name":"Lithuanian"}] |
@@ -1,11 +0,38 @@ | ||
/// <reference path="./types.d.ts" /> | ||
interface Locale { | ||
name: string | ||
weekdays?: string[] | ||
months?: string[] | ||
weekStart?: number | ||
weekdaysShort?: string[] | ||
monthsShort?: string[] | ||
weekdaysMin?: string[] | ||
ordinal?: (n: number) => number | string | ||
formats: Partial<{ | ||
LT: string | ||
LTS: string | ||
L: string | ||
LL: string | ||
LLL: string | ||
LLLL: string | ||
}> | ||
relativeTime: Partial<{ | ||
future: string | ||
past: string | ||
s: string | ||
m: string | ||
mm: string | ||
h: string | ||
hh: string | ||
d: string | ||
dd: string | ||
M: string | ||
MM: string | ||
y: string | ||
yy: string | ||
}> | ||
} | ||
declare module 'dayjs/locale/*' { | ||
namespace locale { | ||
interface Locale extends ILocale {} | ||
} | ||
const locale: locale.Locale | ||
export = locale | ||
const locale: Locale | ||
export default locale | ||
} |
@@ -1,4 +0,4 @@ | ||
import { PluginFunc } from 'dayjs' | ||
import { PluginFunc } from '..' | ||
declare const plugin: PluginFunc | ||
export = plugin | ||
export default plugin |
@@ -1,4 +0,4 @@ | ||
import { PluginFunc } from 'dayjs' | ||
import { PluginFunc } from '..' | ||
declare module 'dayjs' { | ||
declare module '..' { | ||
interface ConfigTypeMap { | ||
@@ -10,2 +10,2 @@ arraySupport: [number?, number?, number?, number?, number?, number?, number?] | ||
declare const plugin: PluginFunc | ||
export = plugin | ||
export default plugin |
@@ -1,4 +0,4 @@ | ||
import { PluginFunc } from 'dayjs' | ||
import { PluginFunc } from '..' | ||
declare const plugin: PluginFunc | ||
export = plugin | ||
export default plugin |
@@ -1,4 +0,4 @@ | ||
import { PluginFunc } from 'dayjs' | ||
import { PluginFunc } from '..' | ||
declare const plugin: PluginFunc | ||
export = plugin | ||
export default plugin |
@@ -1,7 +0,7 @@ | ||
import { PluginFunc, ConfigType } from 'dayjs' | ||
import { PluginFunc, ConfigType } from '..' | ||
declare const plugin: PluginFunc | ||
export = plugin | ||
export default plugin | ||
declare module 'dayjs' { | ||
declare module '..' { | ||
interface Dayjs { | ||
@@ -8,0 +8,0 @@ calendar(referenceTime?: ConfigType, formats?: object): string |
@@ -1,2 +0,2 @@ | ||
import { PluginFunc } from 'dayjs' | ||
import { PluginFunc } from '..' | ||
@@ -8,2 +8,2 @@ declare interface PluginOptions { | ||
declare const plugin: PluginFunc<PluginOptions> | ||
export = plugin | ||
export default plugin |
@@ -1,7 +0,7 @@ | ||
import { PluginFunc } from 'dayjs' | ||
import { PluginFunc } from '..' | ||
declare const plugin: PluginFunc | ||
export = plugin | ||
export default plugin | ||
declare module 'dayjs' { | ||
declare module '..' { | ||
interface Dayjs { | ||
@@ -8,0 +8,0 @@ dayOfYear(): number |
@@ -1,4 +0,4 @@ | ||
import { PluginFunc } from 'dayjs' | ||
import { PluginFunc } from '..' | ||
declare const plugin: PluginFunc | ||
export = plugin | ||
export default plugin |
@@ -1,7 +0,7 @@ | ||
import { PluginFunc } from 'dayjs' | ||
import { OpUnitType, UnitTypeLongPlural } from 'dayjs'; | ||
import { PluginFunc } from '..' | ||
import { OpUnitType, UnitTypeLongPlural } from '..'; | ||
declare const plugin: PluginFunc | ||
export as namespace plugin; | ||
export = plugin | ||
export default plugin | ||
@@ -77,3 +77,3 @@ declare namespace plugin { | ||
declare module 'dayjs' { | ||
declare module '..' { | ||
interface Dayjs { | ||
@@ -89,2 +89,2 @@ add(duration: plugin.Duration): Dayjs | ||
export function isDuration(d: any): d is plugin.Duration | ||
} | ||
} |
@@ -1,7 +0,7 @@ | ||
import { PluginFunc, ConfigType, OpUnitType } from 'dayjs' | ||
import { PluginFunc, ConfigType, OpUnitType } from '..' | ||
declare const plugin: PluginFunc | ||
export = plugin | ||
export default plugin | ||
declare module 'dayjs' { | ||
declare module '..' { | ||
interface Dayjs { | ||
@@ -8,0 +8,0 @@ isBetween(a: ConfigType, b: ConfigType, c?: OpUnitType | null, d?: '()' | '[]' | '[)' | '(]'): boolean |
@@ -1,7 +0,7 @@ | ||
import { PluginFunc } from 'dayjs' | ||
import { PluginFunc } from '..' | ||
declare const plugin: PluginFunc | ||
export = plugin | ||
export default plugin | ||
declare module 'dayjs' { | ||
declare module '..' { | ||
interface Dayjs { | ||
@@ -8,0 +8,0 @@ isLeapYear(): boolean |
@@ -1,7 +0,7 @@ | ||
import { PluginFunc } from 'dayjs' | ||
import { PluginFunc } from '..' | ||
declare const plugin: PluginFunc | ||
export = plugin | ||
export default plugin | ||
declare module 'dayjs' { | ||
declare module '..' { | ||
@@ -8,0 +8,0 @@ export function isMoment(input: any): boolean |
@@ -1,9 +0,9 @@ | ||
import { PluginFunc, OpUnitType, ConfigType } from 'dayjs' | ||
import { PluginFunc, OpUnitType, ConfigType } from '..' | ||
declare const plugin: PluginFunc | ||
export = plugin | ||
export default plugin | ||
type ISOUnitType = OpUnitType | 'isoWeek'; | ||
declare module 'dayjs' { | ||
declare module '..' { | ||
interface Dayjs { | ||
@@ -10,0 +10,0 @@ isoWeekYear(): number |
@@ -1,7 +0,7 @@ | ||
import { PluginFunc } from 'dayjs' | ||
import { PluginFunc } from '..' | ||
declare const plugin: PluginFunc | ||
export = plugin | ||
export default plugin | ||
declare module 'dayjs' { | ||
declare module '..' { | ||
interface Dayjs { | ||
@@ -8,0 +8,0 @@ isoWeeksInYear(): number |
@@ -1,7 +0,7 @@ | ||
import { PluginFunc, ConfigType, OpUnitType } from 'dayjs' | ||
import { PluginFunc, ConfigType, OpUnitType } from '..' | ||
declare const plugin: PluginFunc | ||
export = plugin | ||
export default plugin | ||
declare module 'dayjs' { | ||
declare module '..' { | ||
interface Dayjs { | ||
@@ -8,0 +8,0 @@ isSameOrAfter(date: ConfigType, unit?: OpUnitType): boolean |
@@ -1,7 +0,7 @@ | ||
import { PluginFunc, ConfigType, OpUnitType } from 'dayjs' | ||
import { PluginFunc, ConfigType, OpUnitType } from '..' | ||
declare const plugin: PluginFunc | ||
export = plugin | ||
export default plugin | ||
declare module 'dayjs' { | ||
declare module '..' { | ||
interface Dayjs { | ||
@@ -8,0 +8,0 @@ isSameOrBefore(date: ConfigType, unit?: OpUnitType): boolean |
@@ -1,7 +0,7 @@ | ||
import { PluginFunc } from 'dayjs' | ||
import { PluginFunc } from '..' | ||
declare const plugin: PluginFunc | ||
export = plugin | ||
export default plugin | ||
declare module 'dayjs' { | ||
declare module '..' { | ||
interface Dayjs { | ||
@@ -8,0 +8,0 @@ isToday(): boolean |
@@ -1,7 +0,7 @@ | ||
import { PluginFunc } from 'dayjs' | ||
import { PluginFunc } from '..' | ||
declare const plugin: PluginFunc | ||
export = plugin | ||
export default plugin | ||
declare module 'dayjs' { | ||
declare module '..' { | ||
interface Dayjs { | ||
@@ -8,0 +8,0 @@ isTomorrow(): boolean |
@@ -1,7 +0,7 @@ | ||
import { PluginFunc } from 'dayjs' | ||
import { PluginFunc } from '..' | ||
declare const plugin: PluginFunc | ||
export = plugin | ||
export default plugin | ||
declare module 'dayjs' { | ||
declare module '..' { | ||
interface Dayjs { | ||
@@ -8,0 +8,0 @@ isYesterday(): boolean |
@@ -1,7 +0,7 @@ | ||
import { PluginFunc } from 'dayjs' | ||
import { PluginFunc } from '..' | ||
declare const plugin: PluginFunc | ||
export = plugin | ||
export default plugin | ||
declare module 'dayjs' { | ||
declare module '..' { | ||
type WeekdayNames = [string, string, string, string, string, string, string]; | ||
@@ -8,0 +8,0 @@ type MonthNames = [string, string, string, string, string, string, string, string, string, string, string, string]; |
@@ -1,4 +0,4 @@ | ||
import { PluginFunc } from 'dayjs' | ||
import { PluginFunc } from '..' | ||
declare const plugin: PluginFunc | ||
export = plugin | ||
export default plugin |
@@ -1,7 +0,7 @@ | ||
import { PluginFunc } from 'dayjs' | ||
import { PluginFunc } from '..' | ||
declare const plugin: PluginFunc | ||
export = plugin | ||
export default plugin | ||
declare module 'dayjs' { | ||
declare module '..' { | ||
export function max(dayjs: Dayjs[]): Dayjs | ||
@@ -8,0 +8,0 @@ export function max(...dayjs: Dayjs[]): Dayjs |
@@ -1,7 +0,7 @@ | ||
import { PluginFunc } from 'dayjs' | ||
import { PluginFunc } from '..' | ||
declare const plugin: PluginFunc | ||
export = plugin | ||
export default plugin | ||
declare module 'dayjs' { | ||
declare module '..' { | ||
interface Dayjs { | ||
@@ -8,0 +8,0 @@ set(argument: object): Dayjs |
@@ -1,7 +0,7 @@ | ||
import { PluginFunc, UnitType, ConfigType } from 'dayjs' | ||
import { PluginFunc, UnitType, ConfigType } from '..' | ||
declare const plugin: PluginFunc | ||
export = plugin | ||
export default plugin | ||
declare module 'dayjs' { | ||
declare module '..' { | ||
interface Dayjs { | ||
@@ -8,0 +8,0 @@ years(): number |
@@ -1,4 +0,4 @@ | ||
import { PluginFunc } from 'dayjs' | ||
import { PluginFunc } from '..' | ||
declare const plugin: PluginFunc | ||
export = plugin | ||
export default plugin |
@@ -1,7 +0,7 @@ | ||
import { PluginFunc, ConfigType, QUnitType, OpUnitType } from 'dayjs' | ||
import { PluginFunc, ConfigType, QUnitType, OpUnitType } from '..' | ||
declare const plugin: PluginFunc | ||
export = plugin | ||
export default plugin | ||
declare module 'dayjs' { | ||
declare module '..' { | ||
interface Dayjs { | ||
@@ -8,0 +8,0 @@ quarter(): number |
@@ -1,2 +0,2 @@ | ||
import { PluginFunc, ConfigType } from 'dayjs' | ||
import { PluginFunc, ConfigType } from '..' | ||
@@ -15,6 +15,6 @@ declare interface RelativeTimeThreshold { | ||
declare const plugin: PluginFunc<RelativeTimeOptions> | ||
export = plugin | ||
export default plugin | ||
declare module 'dayjs' { | ||
interface Dayjs { | ||
declare module '..' { | ||
export interface Dayjs { | ||
fromNow(withoutSuffix?: boolean): string | ||
@@ -21,0 +21,0 @@ from(compared: ConfigType, withoutSuffix?: boolean): string |
@@ -1,7 +0,7 @@ | ||
import { PluginFunc, ConfigType } from 'dayjs' | ||
import { PluginFunc, ConfigType } from '..' | ||
declare const plugin: PluginFunc | ||
export = plugin | ||
export default plugin | ||
declare module 'dayjs' { | ||
declare module '..' { | ||
interface Dayjs { | ||
@@ -8,0 +8,0 @@ tz(timezone?: string, keepLocalTime?: boolean): Dayjs |
@@ -1,7 +0,7 @@ | ||
import { PluginFunc } from 'dayjs' | ||
import { PluginFunc } from '..' | ||
declare const plugin: PluginFunc | ||
export = plugin | ||
export default plugin | ||
declare module 'dayjs' { | ||
declare module '..' { | ||
interface Dayjs { | ||
@@ -8,0 +8,0 @@ toArray(): number[] |
@@ -1,5 +0,5 @@ | ||
import { PluginFunc } from 'dayjs' | ||
import { PluginFunc } from '..' | ||
declare const plugin: PluginFunc | ||
export = plugin | ||
export default plugin | ||
@@ -16,3 +16,3 @@ interface DayjsObject { | ||
declare module 'dayjs' { | ||
declare module '..' { | ||
interface Dayjs { | ||
@@ -19,0 +19,0 @@ toObject(): DayjsObject |
@@ -1,8 +0,8 @@ | ||
import { PluginFunc } from 'dayjs' | ||
import { PluginFunc } from '..' | ||
declare const plugin: PluginFunc | ||
export = plugin | ||
export default plugin | ||
declare module 'dayjs' { | ||
declare module '..' { | ||
export function updateLocale(localeName: string, customConfig: Record<string, unknown>): Record<string, unknown> | ||
} |
@@ -1,7 +0,7 @@ | ||
import { PluginFunc, ConfigType } from 'dayjs' | ||
import { PluginFunc, ConfigType } from '..' | ||
declare const plugin: PluginFunc | ||
export = plugin | ||
export default plugin | ||
declare module 'dayjs' { | ||
declare module '..' { | ||
interface Dayjs { | ||
@@ -8,0 +8,0 @@ |
@@ -1,7 +0,7 @@ | ||
import { PluginFunc } from 'dayjs' | ||
import { PluginFunc } from '..' | ||
declare const plugin: PluginFunc | ||
export = plugin | ||
export default plugin | ||
declare module 'dayjs' { | ||
declare module '..' { | ||
interface Dayjs { | ||
@@ -8,0 +8,0 @@ weekday(): number |
@@ -1,7 +0,7 @@ | ||
import { PluginFunc } from 'dayjs' | ||
import { PluginFunc } from '..' | ||
declare const plugin: PluginFunc | ||
export = plugin | ||
export default plugin | ||
declare module 'dayjs' { | ||
declare module '..' { | ||
interface Dayjs { | ||
@@ -8,0 +8,0 @@ week(): number |
@@ -1,7 +0,7 @@ | ||
import { PluginFunc } from 'dayjs' | ||
import { PluginFunc } from '..' | ||
declare const plugin: PluginFunc | ||
export = plugin | ||
export default plugin | ||
declare module 'dayjs' { | ||
declare module '..' { | ||
interface Dayjs { | ||
@@ -8,0 +8,0 @@ weekYear(): number |
{ | ||
"name": "dayjs", | ||
"version": "2.0.0-alpha.3", | ||
"version": "2.0.0-alpha.4", | ||
"description": "2KB immutable date time library alternative to Moment.js with the same modern API ", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"main": "./dist/index.js", | ||
"module": "./dist/esm/index.mjs", | ||
"types": "./dist/index.d.ts", | ||
"exports": { | ||
".": { | ||
"require": "./dist/index.js", | ||
"import": "./dist/index.mjs", | ||
"types": "./dist/index.d.ts" | ||
}, | ||
"./locale/*": { | ||
"require": "./dist/locale/*.js", | ||
"import": "./dist/locale/*.mjs", | ||
"types": "./dist/locale/*.d.ts" | ||
}, | ||
"./plugin/*": { | ||
"require": "./dist/plugin/*.js", | ||
"import": "./dist/plugin/*.mjs", | ||
"types": "./dist/plugin/*.d.ts" | ||
} | ||
}, | ||
"typesVersions": { | ||
"*": { | ||
"*": [ | ||
"*", | ||
"dist/*" | ||
] | ||
} | ||
}, | ||
"scripts": { | ||
@@ -82,5 +108,5 @@ "test": "TZ=Pacific/Auckland npm run test-tz && TZ=Europe/London npm run test-tz && TZ=America/Whitehorse npm run test-tz && npm run test-tz && jest", | ||
"cross-env": "^5.1.6", | ||
"eslint": "^4.19.1", | ||
"eslint-config-airbnb-base": "^12.1.0", | ||
"eslint-plugin-import": "^2.10.0", | ||
"eslint": "^8.24.0", | ||
"eslint-config-airbnb-base": "^15.0.0", | ||
"eslint-plugin-import": "^2.16.0", | ||
"eslint-plugin-jest": "^21.15.0", | ||
@@ -87,0 +113,0 @@ "fast-glob": "^3.2.12", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
814880
583
17434
0