1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-20 21:54:58 -04:00

New: Option to specify timezone for formatting times in the UI

This commit is contained in:
Audionut
2025-10-22 14:07:34 +10:00
committed by GitHub
parent 37dfad11f2
commit 550cf8d399
16 changed files with 321 additions and 35 deletions
+5 -4
View File
@@ -1,15 +1,16 @@
import moment, { MomentInput } from 'moment';
import moment from 'moment-timezone';
import { convertToTimezone } from './convertToTimezone';
function formatTime(
date: MomentInput,
date: moment.MomentInput,
timeFormat: string,
{ includeMinuteZero = false, includeSeconds = false } = {}
{ includeMinuteZero = false, includeSeconds = false, timeZone = '' } = {}
) {
if (!date) {
return '';
}
const time = moment(date);
const time = convertToTimezone(date, timeZone);
if (includeSeconds) {
timeFormat = timeFormat.replace(/\(?:mm\)?/, ':mm:ss');