Files

8 lines
340 B
TypeScript

export const DEFAULT_TAGE_VORHER = [30, 6, 1];
export function parseTageListe(s: string): number[] {
const parts = s.split(",").map((x) => Number(x.trim())).filter((n) => Number.isInteger(n) && n >= 0 && n <= 365);
if (parts.length === 0) throw new Error("Ungültige Tage-Liste");
return [...new Set(parts)].sort((a, b) => b - a);
}