diff options
| author | Martin Kagamino Lehoux <martin@lehoux.net> | 2026-09-30 22:13:07 +0200 |
|---|---|---|
| committer | Martin Kagamino Lehoux <martin@lehoux.net> | 2026-09-30 22:13:07 +0200 |
| commit | a725d4c7d28fee701b6997cc46cffddefbcd26bf (patch) | |
| tree | 1e0899dc9fa67f8c74d7e4b7023881959d571d4f /src/lib/server/services/validation.ts | |
| parent | a17b24b8e95bf85a8522fc0c2cbbdb8da31bf018 (diff) | |
Allow granular routine frequencies like 5/2w
Diffstat (limited to 'src/lib/server/services/validation.ts')
| -rw-r--r-- | src/lib/server/services/validation.ts | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/src/lib/server/services/validation.ts b/src/lib/server/services/validation.ts index b0a515c..a8cebd9 100644 --- a/src/lib/server/services/validation.ts +++ b/src/lib/server/services/validation.ts @@ -1,4 +1,3 @@ -import { parseIntervalToDays } from '$lib/shared/routine-metrics'; import * as v from 'valibot'; export const IdSchema = v.pipe(v.number(), v.integer(), v.minValue(1)); @@ -44,12 +43,3 @@ export function parseOptionalNumber( if (!Number.isFinite(n)) return null; return n; } - -/** Parses an interval like '2w' into days; throws on invalid format. */ -export function parseFrequencyDays(value: FormDataEntryValue | null): number { - const days = parseIntervalToDays(value?.toString() ?? ''); - if (days === null) { - throw new Error('Invalid interval'); - } - return days; -} |
