ptitlutins/app/utils/byStart.ts
2026-06-10 23:37:21 +02:00

10 lines
340 B
TypeScript

import type { Event } from "~/types"
/** Sort: dated events first (chronological), undated last. */
export const byStart = (a: Event, b: Event): number => {
if (a.startDate && b.startDate)
return a.startDate < b.startDate ? -1 : a.startDate > b.startDate ? 1 : 0
if (a.startDate) return -1
if (b.startDate) return 1
return 0
}