29 lines
616 B
TypeScript
29 lines
616 B
TypeScript
/**
|
||
* 限时特惠 / 促销展示配置
|
||
* 恢复原价日期 = 当天 + 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()}日`;
|
||
}
|