Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ declare namespace dayjs {

export type UnitType = UnitTypeLong | UnitTypeLongPlural | UnitTypeShort;

type WithQuarters<T> = T | 'quarter' | 'quarters' | 'Q';

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

export type ManipulateType = Exclude<OpUnitType, 'date' | 'dates'>;
export type ManipulateQType = WithQuarters<ManipulateType>;

class Dayjs {
constructor (config?: ConfigType)
/**
Expand Down
10 changes: 5 additions & 5 deletions types/plugin/quarterOfYear.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PluginFunc, ConfigType, QUnitType, OpUnitType } from 'dayjs'
import { PluginFunc, ConfigType, ManipulateQType, QUnitType } from 'dayjs'

declare const plugin: PluginFunc
export = plugin
Expand All @@ -9,13 +9,13 @@ declare module 'dayjs' {

quarter(quarter: number): Dayjs

add(value: number, unit: QUnitType): Dayjs
add(value: number, unit: ManipulateQType): Dayjs

subtract(value: number, unit: QUnitType): Dayjs
subtract(value: number, unit: ManipulateQType): Dayjs

startOf(unit: QUnitType | OpUnitType): Dayjs
startOf(unit: QUnitType): Dayjs

endOf(unit: QUnitType | OpUnitType): Dayjs
endOf(unit: QUnitType): Dayjs

isSame(date?: ConfigType, unit?: QUnitType): boolean

Expand Down
Loading