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:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user