import dayjs from 'dayjs' /** * 检查当前时间是否在7月28号零点之后 * @returns {boolean} 如果在7月28号零点之后返回true,否则返回false */ export function isAfterJuly28() { const now = new Date(); const july28 = new Date(2025, 6, 28, 0, 0, 0); // 月份从0开始,所以7月是6 return now >= july28; } /** * 检查当前时间是否在指定日期之后 * @param {Date} targetDate 目标日期 * @returns {boolean} 如果在目标日期之后返回true,否则返回false */ export function isAfterDate(targetDate) { const now = new Date(); return now >= targetDate; } /** * 转换时间格式 默认不带时分秒 * @param {Date} date 日期 * @param format 自定义转换格式 * @returns {string} 日期字符串 */ export function formatDate(date,format) { return dayjs(date).format(format?format:'YYYY-MM-DD') }