add support for opening hours that automatically change over time
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import {
|
||||
compareAsc,
|
||||
endOfWeek,
|
||||
startOfToday,
|
||||
startOfWeek,
|
||||
@@ -8,10 +7,10 @@ import {
|
||||
addWeeks,
|
||||
parseISO,
|
||||
} from "date-fns";
|
||||
import { toLocalTime, formatDate } from "./date";
|
||||
import { toLocalTime, formatDate, compareDates } from "./date";
|
||||
import { graphql } from "@/gql";
|
||||
import { EventFragment, EventCategory, EventOccurrence } from "@/gql/graphql";
|
||||
import { PIG_NAMES, PigName, randomElement } from "@/lib/common";
|
||||
import { EventFragment, EventOccurrence } from "@/gql/graphql";
|
||||
import { PIG_NAMES, randomElement } from "@/lib/common";
|
||||
|
||||
export type {
|
||||
EventFragment,
|
||||
@@ -134,10 +133,6 @@ export function getSingularEvents(events: EventFragment[]): SingularEvent[] {
|
||||
.flat();
|
||||
}
|
||||
|
||||
export function compareDates(a: Date | string, b: Date | string) {
|
||||
return compareAsc(new Date(a), new Date(b));
|
||||
}
|
||||
|
||||
export function sortSingularEvents(events: SingularEvent[]) {
|
||||
return events.sort((a, b) =>
|
||||
compareDates(a.occurrence.start, b.occurrence.start)
|
||||
|
||||
Reference in New Issue
Block a user