From 288ae1b4630791818c01778fd320ddfcb3a1c9ba Mon Sep 17 00:00:00 2001 From: Vincent Jo Date: Thu, 3 Feb 2022 10:52:24 -0800 Subject: [PATCH] All: Add additional time format HH.mm (#6086) --- packages/lib/models/Setting.ts | 2 ++ packages/lib/models/dateTimeFormats.test.ts | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/lib/models/Setting.ts b/packages/lib/models/Setting.ts index d5044945d..a68b44dff 100644 --- a/packages/lib/models/Setting.ts +++ b/packages/lib/models/Setting.ts @@ -217,6 +217,7 @@ class Setting extends BaseModel { public static TIME_FORMAT_1 = 'HH:mm'; public static TIME_FORMAT_2 = 'h:mm A'; + public static TIME_FORMAT_3 = 'HH.mm'; public static SHOULD_REENCRYPT_NO = 0; // Data doesn't need to be re-encrypted public static SHOULD_REENCRYPT_YES = 1; // Data should be re-encrypted @@ -741,6 +742,7 @@ class Setting extends BaseModel { const now = new Date('2017-01-30T20:30:00').getTime(); options[Setting.TIME_FORMAT_1] = time.formatMsToLocal(now, Setting.TIME_FORMAT_1); options[Setting.TIME_FORMAT_2] = time.formatMsToLocal(now, Setting.TIME_FORMAT_2); + options[Setting.TIME_FORMAT_3] = time.formatMsToLocal(now, Setting.TIME_FORMAT_3); return options; }, storage: SettingStorage.File, diff --git a/packages/lib/models/dateTimeFormats.test.ts b/packages/lib/models/dateTimeFormats.test.ts index c9802a46a..f89829d26 100644 --- a/packages/lib/models/dateTimeFormats.test.ts +++ b/packages/lib/models/dateTimeFormats.test.ts @@ -39,10 +39,11 @@ describe('dateFormats', function() { // TIME_FORMAT_1 = 'HH:mm'; // TIME_FORMAT_2 = 'h:mm A'; + // TIME_FORMAT_3 = 'HH.mm'; expect(time.formatMsToLocal(now, Setting.TIME_FORMAT_1)).toBe('20:30'); expect(time.formatMsToLocal(now, Setting.TIME_FORMAT_2)).toBe('8:30 PM'); - + expect(time.formatMsToLocal(now, Setting.TIME_FORMAT_3)).toBe('20.30'); })); });