Browse Source

feat(gui-v2): add `dayjs` plugin file

# What's changed?

* add dayjs plugin file so we can make sure all dayjs plugins are installed on app init
pull/2933/head
braks 2 years ago
parent
commit
7c56961365
  1. 10
      packages/nc-gui-v2/plugins/a.dayjs.ts
  2. 11
      packages/nc-gui-v2/utils/dateTimeUtils.ts

10
packages/nc-gui-v2/plugins/a.dayjs.ts

@ -0,0 +1,10 @@
import dayjs from 'dayjs'
import relativeTime from 'dayjs/plugin/relativeTime'
import customParseFormat from 'dayjs/plugin/customParseFormat'
import duration from 'dayjs/plugin/duration'
import utc from 'dayjs/plugin/utc'
dayjs.extend(utc)
dayjs.extend(relativeTime)
dayjs.extend(customParseFormat)
dayjs.extend(duration)

11
packages/nc-gui-v2/utils/dateTimeUtils.ts

@ -1,16 +1,5 @@
import dayjs from 'dayjs'
import relativeTime from 'dayjs/plugin/relativeTime'
import customParseFormat from 'dayjs/plugin/customParseFormat'
import duration from 'dayjs/plugin/duration'
import utc from 'dayjs/plugin/utc'
dayjs.extend(utc)
dayjs.extend(relativeTime)
dayjs.extend(customParseFormat)
dayjs.extend(duration)
export const timeAgo = (date: any) => {
return dayjs.utc(date).fromNow()
}

Loading…
Cancel
Save