pcp-tgu-ops-ui: вкладка Редактор — шаг времени маршрута и формат длительности

- RouteTimeStepper и доработки EditorPanels/TguEditorTab по вводу времени;
- formatDuration: секунды/минуты для коротких интервалов;
- стили tgu-editor.css.
This commit is contained in:
Дмитрий Соловьев
2026-06-02 22:06:06 +03:00
parent c2e2b2922f
commit 240e12f442
4 changed files with 248 additions and 43 deletions
@@ -37,6 +37,16 @@ export function formatDateTime(ms: number): string {
}
export function formatDuration(ms: number): string {
const totalSeconds = Math.max(0, Math.round(ms / 1000));
if (totalSeconds < 60) {
return `${totalSeconds} с`;
}
if (totalSeconds < 3600) {
const minutes = Math.floor(totalSeconds / 60);
const seconds = totalSeconds % 60;
return seconds > 0 ? `${minutes} мин ${seconds} с` : `${minutes} мин`;
}
const hours = ms / 3_600_000;
if (hours < 24) {
return `${Number.isInteger(hours) ? hours : hours.toFixed(1)} ч`;