拍卖行:拍品起止时间

This commit is contained in:
liangtongchuan
2021-03-17 15:43:53 +08:00
parent 0dc4f18d2d
commit a76c0fa7fe
4 changed files with 66 additions and 7 deletions

View File

@@ -129,4 +129,19 @@ export function formatTime(d: Date, type: number) {
if(month < 10) monthStr = '0' + monthStr;
return `${yearStr}/${monthStr}/${dayStr}`;
}
}
}
/**
* @description 获取指定时间后的某个时间点,如给定 date 后的晚八点整
* @export
* @param {Date} date 给定时间
* @param {number} h 给定小时
* @param {number} [m=0] 给定分钟
* @param {number} [s=0] 给定秒
* @returns {Date}
*/
export function getNextTime(date: Date, h: number, m = 0, s = 0): Date {
const milliseconds = date.getTime();
const timeToday = new Date(milliseconds).setHours(h, m, s);
return timeToday > milliseconds ? new Date(timeToday) : new Date(timeToday + PER_DAY * PER_SECOND);
}