Browse Source

chore/gui-v2-date-picker-minor-cleanup

pull/2883/head
Muhammed Mustafa 2 years ago
parent
commit
4923ef7a7b
  1. 7
      packages/nc-gui-v2/components/cell/DatePicker.vue
  2. 3
      packages/nc-gui-v2/utils/dateTimeUtils.ts

7
packages/nc-gui-v2/components/cell/DatePicker.vue

@ -1,14 +1,11 @@
<script setup lang="ts">
import dayjs from 'dayjs'
import customParseFormat from 'dayjs/plugin/customParseFormat'
import { ColumnInj, ReadonlyInj } from '~/context'
const { modelValue } = defineProps<Props>()
const emit = defineEmits(['update:modelValue'])
dayjs.extend(customParseFormat)
interface Props {
modelValue: string
}
@ -38,7 +35,7 @@ const localState = $computed({
return
}
if (val?.isValid()) {
if (val.isValid()) {
emit('update:modelValue', val?.format('YYYY-MM-DD'))
}
},

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

@ -2,8 +2,11 @@ import dayjs from 'dayjs'
import relativeTime from 'dayjs/plugin/relativeTime'
import utc from 'dayjs/plugin/utc'
import customParseFormat from 'dayjs/plugin/customParseFormat'
dayjs.extend(utc)
dayjs.extend(relativeTime)
dayjs.extend(customParseFormat)
export const timeAgo = (date: any) => {
return dayjs.utc(date).fromNow()

Loading…
Cancel
Save