feat(slots): add time validation to prevent past slot selection
This commit is contained in:
parent
10981e2afb
commit
9061c6eda3
@ -80,6 +80,9 @@ export class SlotsService extends BaseService {
|
||||
const slots = getSlotsResult.data.slots;
|
||||
|
||||
const times: Array<{ slotId: string; time: string }> = [];
|
||||
|
||||
const now = dayjs();
|
||||
|
||||
for (const slot of slots) {
|
||||
if (!slot?.datetime_start || !slot?.datetime_end) continue;
|
||||
|
||||
@ -98,7 +101,7 @@ export class SlotsService extends BaseService {
|
||||
potentialDatetimeEnd.isAfter(dayjs(order.datetime_start)),
|
||||
);
|
||||
|
||||
if (!hasConflict) {
|
||||
if (!hasConflict && datetimeStart.isAfter(now, 'minute')) {
|
||||
times.push({ slotId: slot.documentId, time: datetimeStart.toISOString() });
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user