From b49e87a1a02af94cad359c7ee33abe187c03ae3a Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Tue, 14 Apr 2026 20:51:01 +0200 Subject: [PATCH] Add offsetRuntimeClockState and formatRuntimeDayPhaseLabel functions --- src/app/App.tsx | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/app/App.tsx b/src/app/App.tsx index 6aeffa55..96bc3731 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -715,6 +715,28 @@ function createVec3Draft(vector: Vec3): Vec3Draft { }; } +function offsetRuntimeClockState( + state: RuntimeClockState, + deltaHours: number +): RuntimeClockState { + const totalHours = Math.max( + 0, + state.dayCount * HOURS_PER_DAY + state.timeOfDayHours + deltaHours + ); + + return { + timeOfDayHours: normalizeTimeOfDayHours(totalHours), + dayCount: Math.floor(totalHours / HOURS_PER_DAY), + dayLengthMinutes: state.dayLengthMinutes + }; +} + +function formatRuntimeDayPhaseLabel( + dayPhase: ReturnType["dayPhase"] +): string { + return dayPhase.charAt(0).toUpperCase() + dayPhase.slice(1); +} + function createPlayerStartMovementTemplateNumberDraft( template: PlayerStartMovementTemplate ): PlayerStartMovementTemplateNumberDraft {