▍ humdrum codex / soft
647 B raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { z } from "zod";

export const OnThisDayConfig = z.object({
  eventsLimit: z.number().int().min(1).max(20).default(8),
  birthsLimit: z.number().int().min(0).max(10).default(3),
  deathsLimit: z.number().int().min(0).max(10).default(3),
});
export type OnThisDayConfig = z.infer<typeof OnThisDayConfig>;

const Entry = z.object({
  year: z.number().nullable(),
  text: z.string(),
  link: z.string().nullable(),
});

export const OnThisDayPayload = z.object({
  date: z.string(), // "May 20"
  events: z.array(Entry),
  births: z.array(Entry),
  deaths: z.array(Entry),
});
export type OnThisDayPayload = z.infer<typeof OnThisDayPayload>;