This repository has been archived on 2025-04-22. You can view files and clone it, but cannot push or open issues or pull requests.
hlk_autotest/tests/utils/timeUtils.ts
2024-12-29 21:51:02 +08:00

14 lines
419 B
TypeScript

/**
* 获取下一个预约时间段的时间
* - 8:00 --> 8:30
* - 8:30 --> 9:00
* - 8:50 --> 9:00
*/
function getNextAppointmentTime(date = new Date()) {
const currentHour = date.getHours();
const nextTime = date.getMinutes() > 28 ? ':00' : ':30';
const hour = String(currentHour + (nextTime === ':00' ? 1 : 0)).padStart(2, '0');
return `${hour}${nextTime}`;
}
export { getNextAppointmentTime };