修复订单显示bug
This commit is contained in:
@@ -170,11 +170,19 @@ export function buildCustomSlots(selectedDateKey: string, now: Date): Array<Book
|
||||
|
||||
const minStartTime = now.getTime() + MIN_ADVANCE_MINUTES * 60 * 1000
|
||||
|
||||
for (let h = 0; h < 24; h++) {
|
||||
for (let h = 8; h < 20; h++) {
|
||||
for (let m = 0; m < 60; m += CUSTOM_SLOT_STEP_MINUTES) {
|
||||
const startDate = new Date(parsed.year, parsed.month, parsed.day, h, m, 0, 0)
|
||||
const endDate = new Date(parsed.year, parsed.month, parsed.day, h, m + CUSTOM_SLOT_DURATION_MINUTES, 0, 0)
|
||||
|
||||
// 禁止跨天或超出 20:00 的区间
|
||||
if (endDate.getDate() != startDate.getDate()) {
|
||||
continue
|
||||
}
|
||||
if (endDate.getHours() > 20 || (endDate.getHours() == 20 && endDate.getMinutes() > 0)) {
|
||||
continue
|
||||
}
|
||||
|
||||
const startAt = startDate.getTime()
|
||||
const endAt = endDate.getTime()
|
||||
const available = startAt >= minStartTime
|
||||
@@ -264,5 +272,9 @@ export function formatStandardAppointmentTime(
|
||||
if (day == null || slot == null) {
|
||||
return ''
|
||||
}
|
||||
return new Date(slot.startAt).toISOString()
|
||||
const d = new Date(day.timestamp)
|
||||
const year = d.getFullYear()
|
||||
const month = padLeft(d.getMonth() + 1, 2)
|
||||
const dayNum = padLeft(d.getDate(), 2)
|
||||
return year + '-' + month + '-' + dayNum + ' ' + slot.label
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user