fix: format clock from preset (#2066)

* fix: format clock from preset

* fix: add to all views

* chore: format

* refactor: return flat value from common.options.ts
This commit is contained in:
Alex Christoffer Rasmussen
2026-05-03 18:43:58 +02:00
committed by GitHub
parent 1a08b39b8b
commit a5e733246d
14 changed files with 84 additions and 37 deletions
+5 -4
View File
@@ -1,4 +1,4 @@
import { MaybeNumber, OntimeEvent, Settings, TimeFormat } from 'ontime-types';
import { MaybeNumber, MaybeString, OntimeEvent, Settings, TimeFormat } from 'ontime-types';
import {
MILLIS_PER_HOUR,
MILLIS_PER_MINUTE,
@@ -75,8 +75,9 @@ function resolveTimeFormat(fallback12: string, fallback24: string): string {
}
type FormatOptions = {
format12: string;
format24: string;
format12?: string;
format24?: string;
override?: MaybeString;
};
/**
@@ -97,7 +98,7 @@ export const formatTime = (
return '...';
}
const timeFormat = resolver(options?.format12 ?? FORMAT_12, options?.format24 ?? FORMAT_24);
const timeFormat = options?.override ?? resolver(options?.format12 ?? FORMAT_12, options?.format24 ?? FORMAT_24);
const display = formatFromMillis(Math.abs(milliseconds), timeFormat);
const isNegative = milliseconds < 0;