Files
gitlab-instance-0a899031_no…/config/promo.config.ts
2026-03-10 11:48:50 -05:00

29 lines
616 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 限时特惠 / 促销展示配置
* 恢复原价日期 = 当天 + 2 天
*/
const DAYS_OFFSET = 2;
function getRestoreDate(): Date {
const d = new Date();
d.setDate(d.getDate() + DAYS_OFFSET);
return d;
}
/**
* 格式化为中文展示3月12日
*/
export function formatRestoreDateShort(): string {
const d = getRestoreDate();
return `${d.getMonth() + 1}${d.getDate()}`;
}
/**
* 格式化为完整中文2025年3月12日
*/
export function formatRestoreDateFull(): string {
const d = getRestoreDate();
return `${d.getFullYear()}${d.getMonth() + 1}${d.getDate()}`;
}