add support for opening hours that automatically change over time

This commit is contained in:
2024-07-08 02:42:02 +02:00
parent ada7d25083
commit 355887518b
23 changed files with 834 additions and 18 deletions

View File

@@ -1,4 +1,4 @@
import { isToday, isAfter, parse } from "date-fns";
import { isToday, isAfter, parse, compareAsc } from "date-fns";
import { nb } from "date-fns/locale";
import { toZonedTime, format } from "date-fns-tz";
@@ -47,3 +47,7 @@ export function isTodayOrFuture(
const zonedDate = toLocalTime(date);
return isToday(zonedDate) || isAfter(zonedDate, zonedNow);
}
export function compareDates(a: Date | string, b: Date | string) {
return compareAsc(new Date(a), new Date(b));
}