adds fix-availability-slot-addition (#7420)

Co-authored-by: Omar López <zomars@me.com>
pull/7869/head^2
Shafkathullah Ihsan 2023-03-21 23:26:16 +05:30 committed by GitHub
parent eb93524f49
commit 7d9c21cf9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 3 deletions

View File

@ -346,10 +346,16 @@ const useOptions = () => {
};
const getNextRange = (field?: FieldArrayWithId) => {
const nextRangeStart = dayjs((field as unknown as TimeRange).end);
const nextRangeEnd = dayjs(nextRangeStart).add(1, "hour");
const nextRangeStart = dayjs((field as unknown as TimeRange).end).utc();
const nextRangeEnd =
nextRangeStart.hour() === 23
? dayjs(nextRangeStart).add(59, "minutes").add(59, "seconds").add(999, "milliseconds")
: dayjs(nextRangeStart).add(1, "hour");
if (nextRangeEnd.isBefore(nextRangeStart.endOf("day"))) {
if (
nextRangeEnd.isBefore(nextRangeStart.endOf("day")) ||
nextRangeEnd.isSame(nextRangeStart.endOf("day"))
) {
return {
start: nextRangeStart.toDate(),
end: nextRangeEnd.toDate(),