115115
116116<script setup lang="ts">
117117
118- import dayjs from ' dayjs' ;
119- import utc from ' dayjs/plugin/utc' ;
120- import timezone from ' dayjs/plugin/timezone' ;
121- import {checkEmptyValues } from ' @/utils' ;
118+ import {checkEmptyValues , formatDate , formatDateTime , formatTime } from ' @/utils' ;
122119import { useRoute , useRouter } from ' vue-router' ;
123120import " vue3-json-viewer/dist/vue3-json-viewer.css" ;
124121import { computed , defineAsyncComponent } from ' vue' ;
@@ -131,10 +128,6 @@ import type { any } from 'zod';
131128const coreStore = useCoreStore ();
132129const route = useRoute ();
133130
134-
135- dayjs .extend (utc );
136- dayjs .extend (timezone );
137-
138131const props = defineProps <{
139132 column: any ,
140133 record: any
@@ -150,21 +143,6 @@ const canShowForeignRecord = computed(() => {
150143 )?.allowedActions ?.show ;
151144});
152145
153- function formatDateTime(date : string ) {
154- if (! date ) return ' ' ;
155- return dayjs .utc (date ).local ().format (` ${coreStore .config ?.datesFormat } ${coreStore .config ?.timeFormat } ` || ' YYYY-MM-DD HH:mm:ss' );
156- }
157-
158- function formatDate(date : string ) {
159- if (! date ) return ' ' ;
160- return dayjs .utc (date ).local ().format (coreStore .config ?.datesFormat || ' YYYY-MM-DD' );
161- }
162-
163- function formatTime(time : string ) {
164- if (! time ) return ' ' ;
165- return dayjs (` 0000-00-00 ${time } ` ).format (coreStore .config ?.timeFormat || ' HH:mm:ss' );
166- }
167-
168146function getArrayItemDisplayValue(value : any , column : AdminForthResourceColumnCommon ) {
169147 if (column .isArray ?.itemType === ' datetime' ) {
170148 return formatDateTime (value );
0 commit comments