feat: update
This commit is contained in:
16
frontend/admin/src/utils/date.js
Normal file
16
frontend/admin/src/utils/date.js
Normal file
@@ -0,0 +1,16 @@
|
||||
import dayjs from 'dayjs';
|
||||
import timezone from 'dayjs/plugin/timezone';
|
||||
import utc from 'dayjs/plugin/utc';
|
||||
|
||||
// Configure dayjs
|
||||
dayjs.extend(utc);
|
||||
dayjs.extend(timezone);
|
||||
|
||||
/**
|
||||
* Format date to locale string with timezone
|
||||
* @param {string|Date} date - The date to format
|
||||
* @returns {string} Formatted date string
|
||||
*/
|
||||
export function formatDate(date) {
|
||||
return dayjs.tz(date, 'Asia/Shanghai').format('YYYY-MM-DD HH:mm:ss');
|
||||
}
|
||||
Reference in New Issue
Block a user