|
- import dayjs from 'dayjs';
-
- export const datetimeStr = (date) =>{
- date = convertToDate(date);
- return dayjs(date).format("DD-MM-YYYY HH:mm:ss")
- };
-
- export const dateStr = (date) =>{
- date = convertToDate(date);
- return dayjs(date).format("DD-MM-YYYY")
- };
-
- export const convertToDate = (date)=>{
- if(Array.isArray(date)){
- return new Date(date[0],date[1],date[2],date[3],date[4],date[5]);
- }
- if(typeof date == 'number'){
- return new Date(date);
- }
- return date;
- }
|