amarorn / frontend /src /presentation /utils /sofascore.ts
beAnalytic's picture
feat: sync main with feature/superbet-live-inplay
16c19b8 verified
Raw
History Blame Contribute Delete
584 Bytes
import type { WcSchedule, WcScheduleMatch } from "@/domain/entities";
export function findMatchInSchedule(
schedule: WcSchedule,
home: string,
away: string,
): WcScheduleMatch | undefined {
return (
schedule.matches.find((m) => m.homeTeam === home && m.awayTeam === away) ??
schedule.matches.find((m) => m.homeTeam === away && m.awayTeam === home)
);
}
export function kickoffDateFromIso(kickoff: string | null | undefined): string | null {
if (!kickoff) return null;
const day = kickoff.split("T")[0];
return /^\d{4}-\d{2}-\d{2}$/.test(day) ? day : null;
}