import { TaskTemplateRecurrenceType } from "./types"; export const RECURRENCE_TYPE_LABELS: Record = { YEARLY: "Jährlich", MONTHLY: "Monatlich", INTERVAL_DAYS: "Alle X Tage", }; /** Month of a yearly template as the select holds it: "1" = January. */ export type Month = "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12"; export const MONTH_LABELS: Record = { "1": "Januar", "2": "Februar", "3": "März", "4": "April", "5": "Mai", "6": "Juni", "7": "Juli", "8": "August", "9": "September", "10": "Oktober", "11": "November", "12": "Dezember", }; export const MONTHS: Month[] = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"]; /** The stored month number as a select value; January when none is stored. */ export function toMonth(month: number | null | undefined): Month { return MONTHS.find((candidate) => candidate === String(month)) ?? "1"; }