Skip to content

Commit

Permalink
Add more plugin types
Browse files Browse the repository at this point in the history
  • Loading branch information
ypresto committed Feb 21, 2019
1 parent 3610c73 commit 1051814
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/plugin/dayOfYear.d.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import * as dayjs from 'dayjs'
import * as dayOfYear from 'dayjs/plugin/dayOfYear'

dayjs.extend(dayOfYear)

dayjs('2015-01-01T00:00:00.000').dayOfYear() === 1
6 changes: 6 additions & 0 deletions test/plugin/isSameOrAfter.d.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import * as dayjs from 'dayjs'
import * as isSameOrAfter from 'dayjs/plugin/isSameOrAfter'

dayjs.extend(isSameOrAfter)

dayjs('2010-10-20').isSameOrAfter('2010-10-19', 'year') === true
6 changes: 6 additions & 0 deletions test/plugin/isSameOrBefore.d.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import * as dayjs from 'dayjs'
import * as isSameOrBefore from 'dayjs/plugin/isSameOrBefore'

dayjs.extend(isSameOrBefore)

dayjs('2010-10-20').isSameOrBefore('2010-10-19', 'year') === true
6 changes: 6 additions & 0 deletions test/plugin/quarterOfYear.d.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import * as dayjs from 'dayjs'
import * as quarterOfYear from 'dayjs/plugin/quarterOfYear'

dayjs.extend(quarterOfYear)

dayjs('2013-01-01T00:00:00.000').quarter() === 1
4 changes: 4 additions & 0 deletions types/plugin/customParseFormat.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { PluginFunc } from 'dayjs'

declare const plugin: PluginFunc
export = plugin
10 changes: 10 additions & 0 deletions types/plugin/dayOfYear.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { PluginFunc } from 'dayjs'

declare const plugin: PluginFunc
export = plugin

declare module 'dayjs' {
interface Dayjs {
dayOfYear(): number
}
}
10 changes: 10 additions & 0 deletions types/plugin/isSameOrAfter.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { PluginFunc } from 'dayjs'

declare const plugin: PluginFunc
export = plugin

declare module 'dayjs' {
interface Dayjs {
isSameOrAfter(date: DateType, unit?: OpUnitType): boolean
}
}
10 changes: 10 additions & 0 deletions types/plugin/isSameOrBefore.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { PluginFunc } from 'dayjs'

declare const plugin: PluginFunc
export = plugin

declare module 'dayjs' {
interface Dayjs {
isSameOrBefore(date: DateType, unit?: OpUnitType): boolean
}
}
4 changes: 4 additions & 0 deletions types/plugin/localizedFormat.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { PluginFunc } from 'dayjs'

declare const plugin: PluginFunc
export = plugin
10 changes: 10 additions & 0 deletions types/plugin/quarterOfYear.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { PluginFunc } from 'dayjs'

declare const plugin: PluginFunc
export = plugin

declare module 'dayjs' {
interface Dayjs {
quarter(): number
}
}

0 comments on commit 1051814

Please sign in to comment.