relativeTime.d.ts 586 B

123456789101112131415161718192021222324
  1. import { PluginFunc, ConfigType } from 'dayjs'
  2. declare interface RelativeTimeThreshold {
  3. l: string
  4. r?: number
  5. d?: string
  6. }
  7. declare interface RelativeTimeOptions {
  8. rounding?: (num: number) => number
  9. thresholds?: RelativeTimeThreshold[]
  10. }
  11. declare const plugin: PluginFunc<RelativeTimeOptions>
  12. export = plugin
  13. declare module 'dayjs' {
  14. interface Dayjs {
  15. fromNow(withoutSuffix?: boolean): string
  16. from(compared: ConfigType, withoutSuffix?: boolean): string
  17. toNow(withoutSuffix?: boolean): string
  18. to(compared: ConfigType, withoutSuffix?: boolean): string
  19. }
  20. }