From 2b49c7e0060957b6ac9476a0eb9d1bcc1561124c Mon Sep 17 00:00:00 2001 From: Gustavo Saiani <gustavo@poe.ma> Date: Thu, 21 Jul 2022 22:56:20 +0200 Subject: [PATCH] Remove unused function (#24158) --- frontend/src/metabase/lib/i18n.js | 7 ------ frontend/test/metabase/lib/i18n.unit.spec.js | 25 -------------------- 2 files changed, 32 deletions(-) delete mode 100644 frontend/test/metabase/lib/i18n.unit.spec.js diff --git a/frontend/src/metabase/lib/i18n.js b/frontend/src/metabase/lib/i18n.js index 1251237c68a..755689fb51b 100644 --- a/frontend/src/metabase/lib/i18n.js +++ b/frontend/src/metabase/lib/i18n.js @@ -100,13 +100,6 @@ function mapToMomentLocale(locale = "") { } } -// Format a fixed timestamp in local time to see if the current locale defaults -// to using a 24 hour clock. -export function isLocale24Hour() { - const formattedTime = moment("2000-01-01T13:00:00").format("LT"); - return /^13:/.test(formattedTime); -} - // we delete msgid property since it's redundant, but have to add it back in to // make ttag happy function addMsgIds(translationsObject) { diff --git a/frontend/test/metabase/lib/i18n.unit.spec.js b/frontend/test/metabase/lib/i18n.unit.spec.js deleted file mode 100644 index 596052b81aa..00000000000 --- a/frontend/test/metabase/lib/i18n.unit.spec.js +++ /dev/null @@ -1,25 +0,0 @@ -import moment from "moment-timezone"; - -import { isLocale24Hour } from "metabase/lib/i18n"; - -describe("isLocale24Hour", () => { - const testCases = [ - ["en", false], - ["en-us", false], - ["en-gb", true], - ["fr", true], - ["zh-cn", true], - ]; - for (const [locale, is24] of testCases) { - it(`should return ${is24} for '${locale}'`, () => { - // save locale before changing it - const startingLocale = moment.locale(); - - moment.locale(locale); - expect(isLocale24Hour()).toBe(is24); - - // reset locale - moment.locale(startingLocale); - }); - } -}); -- GitLab