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'); }