mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 12:32:43 +00:00
Largest feature delta in the v1.4.x line. Insights expands into seven dedicated metric sub-pages; GLP-1 medication tracking lands end-to-end (drug-level chart with Research Mode acknowledgment, EMA titration ladder, cadence + compliance, side-effect taxonomy, pen/vial inventory); cross-source priority becomes a two-axis resolver; per-user timezone threads through ten analytics surfaces; Withings activity + sleep v2 sync; onboarding rebuilt as a nested-route wizard; Personal Records ship end-to-end; Health Score provenance accordion; Coach runs native first-party prompts across six locales with a 1800-assertion refusal-probe matrix; OpenAPI drift gate hard-fails; multi-arch GHCR image. Migrations 0043 through 0060 are additive and forward-only. PROMPT_VERSION 4.24.0 → 4.25.0 with GROUND RULE 9 (refuses dose recommendations) and GROUND RULE 15 (refuses drug-level estimates with MDR + MDCG 2021-24 cites). See CHANGELOG.md for the full per-section delta.
38 lines
1.3 KiB
TypeScript
38 lines
1.3 KiB
TypeScript
export function formatTimeWindowPart(value: string): string {
|
||
const m = /^(\d{1,2}):(\d{2})$/.exec(value.trim());
|
||
if (!m) return value;
|
||
const hh = m[1].padStart(2, "0");
|
||
const mm = m[2];
|
||
return `${hh}:${mm}`;
|
||
}
|
||
|
||
import type { Locale } from "@/lib/i18n/config";
|
||
|
||
/**
|
||
* Render a daily intake time window like "08:00 bis 12:00 Uhr" / "08:00 – 12:00".
|
||
*
|
||
* The historic call sites (see `medication-card.tsx`, `medication-form.tsx`)
|
||
* never passed a locale, so the renderer hard-coded the German "bis ... Uhr"
|
||
* suffix and the English locale ended up with mixed-language strings such as
|
||
* `"Today, 19:00 bis 23:00 Uhr"`. Pass the active UI locale so that the right
|
||
* separator + suffix are picked. When no locale is provided we keep the
|
||
* legacy German output for backwards compatibility with any consumer we may
|
||
* have missed.
|
||
*
|
||
* v1.4.25 W9e — locales other than DE render with the language-neutral
|
||
* "08:00 – 12:00" form (the same as EN) until a locale-specific suffix
|
||
* ships. The DE branch keeps its trailing "Uhr" suffix verbatim.
|
||
*/
|
||
export function formatTimeWindowRange(
|
||
start: string,
|
||
end: string,
|
||
locale?: Locale,
|
||
): string {
|
||
const s = formatTimeWindowPart(start);
|
||
const e = formatTimeWindowPart(end);
|
||
if (locale === undefined || locale === "de") {
|
||
return `${s} bis ${e} Uhr`;
|
||
}
|
||
return `${s} – ${e}`;
|
||
}
|