From 80fe4022c0611abfa7ea60b877678d103d34b84c Mon Sep 17 00:00:00 2001 From: Espen Hovlandsdal Date: Wed, 1 Nov 2023 23:44:53 -0700 Subject: [PATCH] fix(i18n): drop microsecond, nanosecond from unit formatter They are not supported by node 18. --- .../hooks/__tests__/useUnitFormatter.test.tsx | 40 +++++++++---------- .../sanity/src/core/hooks/useUnitFormatter.ts | 2 - 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/packages/sanity/src/core/hooks/__tests__/useUnitFormatter.test.tsx b/packages/sanity/src/core/hooks/__tests__/useUnitFormatter.test.tsx index 5ac3a26acfa..2f316fb9452 100644 --- a/packages/sanity/src/core/hooks/__tests__/useUnitFormatter.test.tsx +++ b/packages/sanity/src/core/hooks/__tests__/useUnitFormatter.test.tsx @@ -92,7 +92,6 @@ describe('useUnitFormatter', () => { 'megabit', 'megabyte', 'meter', - 'microsecond', 'mile', 'mile-scandinavian', 'milliliter', @@ -100,7 +99,6 @@ describe('useUnitFormatter', () => { 'millisecond', 'minute', 'month', - 'nanosecond', 'ounce', 'percent', 'petabyte', @@ -144,26 +142,24 @@ describe('useUnitFormatter', () => { megabit: '22 Mb', megabyte: '23 MB', meter: '24 m', - microsecond: '25 μs', - mile: '26 mi', - 'mile-scandinavian': '27 smi', - milliliter: '28 mL', - millimeter: '29 mm', - millisecond: '30 ms', - minute: '31 min', - month: '32 mths', - nanosecond: '33 ns', - ounce: '34 oz', - percent: '35%', - petabyte: '36 PB', - pound: '37 lb', - second: '38 sec', - stone: '39 st', - terabit: '40 Tb', - terabyte: '41 TB', - week: '42 wks', - yard: '43 yd', - year: '44 yrs', + mile: '25 mi', + 'mile-scandinavian': '26 smi', + milliliter: '27 mL', + millimeter: '28 mm', + millisecond: '29 ms', + minute: '30 min', + month: '31 mths', + ounce: '32 oz', + percent: '33%', + petabyte: '34 PB', + pound: '35 lb', + second: '36 sec', + stone: '37 st', + terabit: '38 Tb', + terabyte: '39 TB', + week: '40 wks', + yard: '41 yd', + year: '42 yrs', }) }) }) diff --git a/packages/sanity/src/core/hooks/useUnitFormatter.ts b/packages/sanity/src/core/hooks/useUnitFormatter.ts index ec89affa8ba..174a6df2a2a 100644 --- a/packages/sanity/src/core/hooks/useUnitFormatter.ts +++ b/packages/sanity/src/core/hooks/useUnitFormatter.ts @@ -39,7 +39,6 @@ export type FormattableMeasurementUnit = | 'megabit' | 'megabyte' | 'meter' - | 'microsecond' | 'mile' | 'mile-scandinavian' | 'milliliter' @@ -47,7 +46,6 @@ export type FormattableMeasurementUnit = | 'millisecond' | 'minute' | 'month' - | 'nanosecond' | 'ounce' | 'percent' | 'petabyte'