feat(date): add DateTimeField and migrate datetime inputs

Add a dependency-free DateTimeField that paints the date part in the
user's date-order preference and the time part in the hour-cycle
preference over a hidden native datetime-local input, preserving the
local yyyy-MM-ddTHH:mm value contract. Migrate the seven DateTimeInput
callsites (measurement add/edit, mood add/edit, lab add/edit,
medication intake quick-add) so the chosen format is honoured there too,
and cover the field's value contract and per-preference rendering with a
component test.
This commit is contained in:
Marc-André Bombeck committed 2026-06-26 13:17:55 +02:00
1 parent 0816b3b0c0
commit 01b24c4d73
9 files changed
+394 -21

No files matched your search

@@ -5,7 +5,7 @@ import { createPortal } from "react-dom";
import { useQuery, useQueryClient } from "@tanstack/react-query";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { DateTimeInput } from "@/components/ui/date-input";
import { DateTimeField } from "@/components/ui/date-time-field";
import { Label } from "@/components/ui/label";
import {
Select,
@@ -454,11 +454,11 @@ export function MedicationIntakeQuickAdd({
<Label htmlFor="medication-intake-taken-at">
{t("dashboard.medicationIntakeQuickAdd.timeLabel")}
</Label>
<DateTimeInput
<DateTimeField
id="medication-intake-taken-at"
data-testid="medication-intake-quick-add-taken-at"
value={takenAt}
onChange={(e) => setTakenAt(e.target.value)}
onChange={setTakenAt}
required
aria-required="true"
aria-invalid={!!error || undefined}