@openmrs/esm-utils 5.3.3-pre.1240 → 5.3.3-pre.1247

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/jest.config.js CHANGED
@@ -1,9 +1,9 @@
1
1
  module.exports = {
2
2
  transform: {
3
- "^.+\\.tsx?$": ["@swc/jest"],
3
+ '^.+\\.tsx?$': ['@swc/jest'],
4
4
  },
5
- testEnvironment: "jsdom",
5
+ testEnvironment: 'jsdom',
6
6
  testEnvironmentOptions: {
7
- url: "http://localhost/",
7
+ url: 'http://localhost/',
8
8
  },
9
9
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-utils",
3
- "version": "5.3.3-pre.1240",
3
+ "version": "5.3.3-pre.1247",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Helper utilities for OpenMRS",
6
6
  "browser": "dist/openmrs-esm-utils.js",
@@ -1,5 +1,5 @@
1
1
  /** @module @category Utility */
2
- import { getLocale } from "./omrs-dates";
2
+ import { getLocale } from './omrs-dates';
3
3
 
4
4
  /**
5
5
  * Gets the number of days in the year of the given date.
@@ -8,8 +8,7 @@ import { getLocale } from "./omrs-dates";
8
8
  */
9
9
  export function daysIntoYear(date: Date) {
10
10
  return (
11
- (Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate()) -
12
- Date.UTC(date.getUTCFullYear(), 0, 0)) /
11
+ (Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate()) - Date.UTC(date.getUTCFullYear(), 0, 0)) /
13
12
  24 /
14
13
  60 /
15
14
  60 /
@@ -26,10 +25,7 @@ export function daysIntoYear(date: Date) {
26
25
  export function isSameDay(firstDate: Date, secondDate: Date) {
27
26
  const firstISO = firstDate.toISOString();
28
27
  const secondISO = secondDate.toISOString();
29
- return (
30
- firstISO.slice(0, firstISO.indexOf("T")) ===
31
- secondISO.slice(0, secondISO.indexOf("T"))
32
- );
28
+ return firstISO.slice(0, firstISO.indexOf('T')) === secondISO.slice(0, secondISO.indexOf('T'));
33
29
  }
34
30
 
35
31
  /**
@@ -68,37 +64,37 @@ export function age(dateString: string): string {
68
64
  // Depending on their age, return a different representation of their age.
69
65
  if (age === 0) {
70
66
  if (isSameDay(today, birthDate)) {
71
- const rtf = new Intl.RelativeTimeFormat(locale, { numeric: "auto" });
72
- return rtf.format(0, "day");
67
+ const rtf = new Intl.RelativeTimeFormat(locale, { numeric: 'auto' });
68
+ return rtf.format(0, 'day');
73
69
  } else if (totalDaysAgo < 31) {
74
70
  const totalDaysAgoStr = new Intl.NumberFormat(locale, {
75
- style: "unit",
76
- unit: "day",
77
- unitDisplay: "short",
71
+ style: 'unit',
72
+ unit: 'day',
73
+ unitDisplay: 'short',
78
74
  }).format(totalDaysAgo);
79
75
 
80
76
  return totalDaysAgoStr;
81
77
  } else {
82
78
  const weeksAgoStr = new Intl.NumberFormat(locale, {
83
- style: "unit",
84
- unit: "week",
85
- unitDisplay: "short",
79
+ style: 'unit',
80
+ unit: 'week',
81
+ unitDisplay: 'short',
86
82
  }).format(weeksAgo);
87
83
  return weeksAgoStr;
88
84
  }
89
85
  } else if (age < 2) {
90
86
  const monthsAgoStr = new Intl.NumberFormat(locale, {
91
- style: "unit",
92
- unit: "month",
93
- unitDisplay: "short",
87
+ style: 'unit',
88
+ unit: 'month',
89
+ unitDisplay: 'short',
94
90
  }).format(monthsAgo + 12);
95
91
 
96
92
  return monthsAgoStr;
97
93
  } else {
98
94
  const yearsAgoStr = new Intl.NumberFormat(locale, {
99
- style: "unit",
100
- unit: "year",
101
- unitDisplay: "short",
95
+ style: 'unit',
96
+ unit: 'year',
97
+ unitDisplay: 'short',
102
98
  }).format(age);
103
99
  return yearsAgoStr;
104
100
  }
package/src/index.ts CHANGED
@@ -1,6 +1,6 @@
1
- export * from "./age-helpers";
2
- export * from "./omrs-dates";
3
- export * from "./shallowEqual";
4
- export * from "./translate";
5
- export * from "./version";
6
- export * from "./retry";
1
+ export * from './age-helpers';
2
+ export * from './omrs-dates';
3
+ export * from './shallowEqual';
4
+ export * from './translate';
5
+ export * from './version';
6
+ export * from './retry';
@@ -1,207 +1,177 @@
1
- import {
2
- toOmrsIsoString,
3
- toDateObjectStrict,
4
- isOmrsDateStrict,
5
- } from "./omrs-dates";
6
- import dayjs from "dayjs";
7
- import timezoneMock from "timezone-mock";
8
- import { formatDate, formatDatetime, formatTime } from ".";
9
- import { i18n } from "i18next";
10
-
11
- window.i18next = { language: "en" } as i18n;
12
-
13
- describe("Openmrs Dates", () => {
14
- it("converts js Date object to omrs date string version", () => {
15
- var date = dayjs(
16
- "2018-03-19T00:05:03.999+0300",
17
- "YYYY-MM-DDTHH:mm:ss.SSSZZ"
18
- ).toDate();
19
- expect(toOmrsIsoString(date, true)).toEqual("2018-03-18T21:05:03.999+0000");
1
+ import { toOmrsIsoString, toDateObjectStrict, isOmrsDateStrict } from './omrs-dates';
2
+ import dayjs from 'dayjs';
3
+ import timezoneMock from 'timezone-mock';
4
+ import { formatDate, formatDatetime, formatTime } from '.';
5
+ import { i18n } from 'i18next';
6
+
7
+ window.i18next = { language: 'en' } as i18n;
8
+
9
+ describe('Openmrs Dates', () => {
10
+ it('converts js Date object to omrs date string version', () => {
11
+ var date = dayjs('2018-03-19T00:05:03.999+0300', 'YYYY-MM-DDTHH:mm:ss.SSSZZ').toDate();
12
+ expect(toOmrsIsoString(date, true)).toEqual('2018-03-18T21:05:03.999+0000');
20
13
  });
21
14
 
22
- it("checks if a string is openmrs date", () => {
23
- expect(isOmrsDateStrict("2018-03-19T00:00:00.000+0300")).toEqual(true);
24
- expect(isOmrsDateStrict(" 2018-03-19T00:00:00.000+0300 ")).toEqual(true);
25
- expect(isOmrsDateStrict("2023-10-06T12:56:56.065-0400")).toEqual(true);
15
+ it('checks if a string is openmrs date', () => {
16
+ expect(isOmrsDateStrict('2018-03-19T00:00:00.000+0300')).toEqual(true);
17
+ expect(isOmrsDateStrict(' 2018-03-19T00:00:00.000+0300 ')).toEqual(true);
18
+ expect(isOmrsDateStrict('2023-10-06T12:56:56.065-0400')).toEqual(true);
26
19
  // the exclusion test cases are important for strictness
27
- expect(isOmrsDateStrict("2018-03-19 00:00:00.000+0300")).toEqual(false);
28
- expect(isOmrsDateStrict("2018-03-19T00:00:00.000+03:00")).toEqual(false);
29
- expect(isOmrsDateStrict("2018-03-19T00:00:00.000 0300")).toEqual(false);
30
- expect(isOmrsDateStrict("2018-03-19T00:00:00 000+0300")).toEqual(false);
31
- expect(isOmrsDateStrict("2018-03-1")).toEqual(false);
32
- expect(isOmrsDateStrict("")).toEqual(false);
20
+ expect(isOmrsDateStrict('2018-03-19 00:00:00.000+0300')).toEqual(false);
21
+ expect(isOmrsDateStrict('2018-03-19T00:00:00.000+03:00')).toEqual(false);
22
+ expect(isOmrsDateStrict('2018-03-19T00:00:00.000 0300')).toEqual(false);
23
+ expect(isOmrsDateStrict('2018-03-19T00:00:00 000+0300')).toEqual(false);
24
+ expect(isOmrsDateStrict('2018-03-1')).toEqual(false);
25
+ expect(isOmrsDateStrict('')).toEqual(false);
33
26
  expect(isOmrsDateStrict(null as any)).toEqual(false);
34
27
  expect(isOmrsDateStrict(undefined as any)).toEqual(false);
35
28
  });
36
29
 
37
- it("converts omrs date string version to js Date object", () => {
38
- expect(
39
- toDateObjectStrict("2018-03-19T00:00:00.000+0300")?.toUTCString()
40
- ).toEqual("Sun, 18 Mar 2018 21:00:00 GMT");
41
- expect(toDateObjectStrict("2018-03-19")).toEqual(null);
30
+ it('converts omrs date string version to js Date object', () => {
31
+ expect(toDateObjectStrict('2018-03-19T00:00:00.000+0300')?.toUTCString()).toEqual('Sun, 18 Mar 2018 21:00:00 GMT');
32
+ expect(toDateObjectStrict('2018-03-19')).toEqual(null);
42
33
  });
43
34
 
44
- it("converts js Date object to omrs date string version", () => {
45
- var date = dayjs(
46
- "2018-03-19T00:05:03.999+0300",
47
- "YYYY-MM-DDTHH:mm:ss.SSSZZ"
48
- ).toDate();
49
- expect(toOmrsIsoString(date, true)).toEqual("2018-03-18T21:05:03.999+0000");
35
+ it('converts js Date object to omrs date string version', () => {
36
+ var date = dayjs('2018-03-19T00:05:03.999+0300', 'YYYY-MM-DDTHH:mm:ss.SSSZZ').toDate();
37
+ expect(toOmrsIsoString(date, true)).toEqual('2018-03-18T21:05:03.999+0000');
50
38
  });
51
39
 
52
40
  it("formats 'Today' with respect to the locale", () => {
53
41
  const testDate = new Date();
54
42
  testDate.setHours(15);
55
43
  testDate.setMinutes(22);
56
- window.i18next.language = "en";
44
+ window.i18next.language = 'en';
57
45
  expect(formatDate(testDate)).toMatch(/Today,\s+03:22\sPM/);
58
46
  expect(formatDate(testDate, { day: false })).toMatch(/Today,\s03:22\sPM/);
59
47
  expect(formatDate(testDate, { year: false })).toMatch(/Today,\s03:22\sPM/);
60
- expect(formatDate(testDate, { mode: "wide" })).toMatch(/Today,\s03:22\sPM/);
61
- window.i18next.language = "sw";
62
- expect(formatDate(testDate)).toEqual("Leo, 15:22");
63
- window.i18next.language = "ru";
64
- expect(formatDate(testDate)).toEqual("Сегодня, 15:22");
48
+ expect(formatDate(testDate, { mode: 'wide' })).toMatch(/Today,\s03:22\sPM/);
49
+ window.i18next.language = 'sw';
50
+ expect(formatDate(testDate)).toEqual('Leo, 15:22');
51
+ window.i18next.language = 'ru';
52
+ expect(formatDate(testDate)).toEqual('Сегодня, 15:22');
65
53
  });
66
54
 
67
- it("formats dates with respect to the locale", () => {
68
- timezoneMock.register("UTC");
69
- const testDate = new Date("2021-12-09T13:15:33");
70
- window.i18next.language = "en";
71
- expect(formatDate(testDate)).toEqual("09-Dec-2021");
72
- expect(formatDate(testDate, { day: false })).toEqual("Dec 2021");
73
- expect(formatDate(testDate, { year: false })).toEqual("09 Dec");
74
- expect(formatDate(testDate, { mode: "wide" })).toEqual("09 — Dec — 2021");
75
- expect(formatDate(testDate, { mode: "wide", year: false })).toEqual(
76
- "09 Dec"
77
- );
78
- window.i18next.language = "fr";
79
- expect(formatDate(testDate)).toEqual("09 déc. 2021");
80
- expect(formatDate(testDate, { day: false })).toEqual("déc. 2021");
81
- expect(formatDate(testDate, { year: false })).toEqual("09 déc.");
82
- expect(formatDate(testDate, { mode: "wide" })).toEqual("09 déc. — 2021");
83
- window.i18next.language = "sw";
84
- expect(formatDate(testDate)).toEqual("09 Des 2021");
85
- window.i18next.language = "ru";
86
- expect(formatDate(testDate, { mode: "wide" })).toMatch(
87
- /09\s—\sдек\.\s—\s2021\sг\./
88
- );
55
+ it('formats dates with respect to the locale', () => {
56
+ timezoneMock.register('UTC');
57
+ const testDate = new Date('2021-12-09T13:15:33');
58
+ window.i18next.language = 'en';
59
+ expect(formatDate(testDate)).toEqual('09-Dec-2021');
60
+ expect(formatDate(testDate, { day: false })).toEqual('Dec 2021');
61
+ expect(formatDate(testDate, { year: false })).toEqual('09 Dec');
62
+ expect(formatDate(testDate, { mode: 'wide' })).toEqual('09 — Dec — 2021');
63
+ expect(formatDate(testDate, { mode: 'wide', year: false })).toEqual('09 — Dec');
64
+ window.i18next.language = 'fr';
65
+ expect(formatDate(testDate)).toEqual('09 déc. 2021');
66
+ expect(formatDate(testDate, { day: false })).toEqual('déc. 2021');
67
+ expect(formatDate(testDate, { year: false })).toEqual('09 déc.');
68
+ expect(formatDate(testDate, { mode: 'wide' })).toEqual('09 — déc. 2021');
69
+ window.i18next.language = 'sw';
70
+ expect(formatDate(testDate)).toEqual('09 Des 2021');
71
+ window.i18next.language = 'ru';
72
+ expect(formatDate(testDate, { mode: 'wide' })).toMatch(/09\s—\sдек\.\s—\s2021\sг\./);
89
73
  });
90
74
 
91
- it("formats dates with respect to the active calendar", () => {
92
- timezoneMock.register("UTC");
93
- const testDate = new Date("2021-12-09T13:15:33");
94
- window.i18next.language = "am";
95
- expect(formatDate(testDate)).toEqual("30-ኅዳር-2014");
96
- expect(formatDate(testDate, { day: false })).toEqual("ኅዳር 2014");
97
- expect(formatDate(testDate, { year: false })).toEqual("ኅዳር 30");
98
- expect(formatDate(testDate, { mode: "wide" })).toEqual("30 — ኅዳር — 2014");
99
- expect(formatDate(testDate, { mode: "wide", year: false })).toEqual(
100
- "ኅዳር — 30"
101
- );
102
-
103
- window.i18next.language = "am-ET";
104
- expect(formatDate(testDate)).toEqual("30-ኅዳር-2014");
105
- expect(formatDate(testDate, { day: false })).toEqual("ኅዳር 2014");
106
- expect(formatDate(testDate, { year: false })).toEqual("ኅዳር 30");
107
- expect(formatDate(testDate, { mode: "wide" })).toEqual("30 — ኅዳር — 2014");
108
- expect(formatDate(testDate, { mode: "wide", year: false })).toEqual(
109
- "ኅዳር — 30"
110
- );
111
-
112
- window.i18next.language = "en-u-ca-ethiopic";
113
- expect(formatDate(testDate)).toEqual("30-Hedar-2014");
114
- expect(formatDate(testDate, { day: false })).toEqual("Hedar 2014");
115
- expect(formatDate(testDate, { year: false })).toEqual("30 Hedar");
116
- expect(formatDate(testDate, { mode: "wide" })).toEqual("30 Hedar — 2014");
117
- expect(formatDate(testDate, { mode: "wide", year: false })).toEqual(
118
- "30 Hedar"
119
- );
120
-
121
- window.i18next.language = "th-TH";
122
- expect(formatDate(testDate)).toEqual("09 ธ.ค. 2564");
123
- expect(formatDate(testDate, { day: false })).toEqual("ธ.ค. 2564");
124
- expect(formatDate(testDate, { year: false })).toEqual("09 ธ.ค.");
125
- expect(formatDate(testDate, { mode: "wide" })).toEqual("09 — ธ.ค. — 2564");
126
- expect(formatDate(testDate, { mode: "wide", year: false })).toEqual(
127
- "09 — ธ.ค."
128
- );
75
+ it('formats dates with respect to the active calendar', () => {
76
+ timezoneMock.register('UTC');
77
+ const testDate = new Date('2021-12-09T13:15:33');
78
+ window.i18next.language = 'am';
79
+ expect(formatDate(testDate)).toEqual('30-ኅዳር-2014');
80
+ expect(formatDate(testDate, { day: false })).toEqual('ኅዳር 2014');
81
+ expect(formatDate(testDate, { year: false })).toEqual('ኅዳር 30');
82
+ expect(formatDate(testDate, { mode: 'wide' })).toEqual('30 — ኅዳር — 2014');
83
+ expect(formatDate(testDate, { mode: 'wide', year: false })).toEqual('ኅዳር — 30');
84
+
85
+ window.i18next.language = 'am-ET';
86
+ expect(formatDate(testDate)).toEqual('30-ኅዳር-2014');
87
+ expect(formatDate(testDate, { day: false })).toEqual('ኅዳር 2014');
88
+ expect(formatDate(testDate, { year: false })).toEqual('ኅዳር 30');
89
+ expect(formatDate(testDate, { mode: 'wide' })).toEqual('30 — ኅዳር 2014');
90
+ expect(formatDate(testDate, { mode: 'wide', year: false })).toEqual('ኅዳር 30');
91
+
92
+ window.i18next.language = 'en-u-ca-ethiopic';
93
+ expect(formatDate(testDate)).toEqual('30-Hedar-2014');
94
+ expect(formatDate(testDate, { day: false })).toEqual('Hedar 2014');
95
+ expect(formatDate(testDate, { year: false })).toEqual('30 Hedar');
96
+ expect(formatDate(testDate, { mode: 'wide' })).toEqual('30 Hedar — 2014');
97
+ expect(formatDate(testDate, { mode: 'wide', year: false })).toEqual('30Hedar');
98
+
99
+ window.i18next.language = 'th-TH';
100
+ expect(formatDate(testDate)).toEqual('09 ธ.ค. 2564');
101
+ expect(formatDate(testDate, { day: false })).toEqual('ธ.ค. 2564');
102
+ expect(formatDate(testDate, { year: false })).toEqual('09 ธ.ค.');
103
+ expect(formatDate(testDate, { mode: 'wide' })).toEqual('09 — ธ.ค. — 2564');
104
+ expect(formatDate(testDate, { mode: 'wide', year: false })).toEqual('09 — ธ.ค.');
129
105
  });
130
106
 
131
- it("handles leap years correctly in Ethiopian locales", () => {
132
- timezoneMock.register("UTC");
133
- const dateBeforeLeapYear = new Date("2023-09-11T09:00:00");
107
+ it('handles leap years correctly in Ethiopian locales', () => {
108
+ timezoneMock.register('UTC');
109
+ const dateBeforeLeapYear = new Date('2023-09-11T09:00:00');
134
110
 
135
- window.i18next.language = "en";
136
- expect(formatDate(dateBeforeLeapYear)).toEqual("11-Sept-2023");
111
+ window.i18next.language = 'en';
112
+ expect(formatDate(dateBeforeLeapYear)).toEqual('11-Sept-2023');
137
113
 
138
- window.i18next.language = "am";
139
- expect(formatDate(dateBeforeLeapYear)).toEqual("06-ጳጉሜን-2015");
114
+ window.i18next.language = 'am';
115
+ expect(formatDate(dateBeforeLeapYear)).toEqual('06-ጳጉሜን-2015');
140
116
 
141
- const dateAfterLeapYear = new Date("2023-09-12T09:00:00");
142
- expect(formatDate(dateAfterLeapYear)).toEqual("01-መስከረም-2016");
117
+ const dateAfterLeapYear = new Date('2023-09-12T09:00:00');
118
+ expect(formatDate(dateAfterLeapYear)).toEqual('01-መስከረም-2016');
143
119
  });
144
120
 
145
- it("respects the `time` option", () => {
146
- timezoneMock.register("UTC");
147
- const testDate = new Date("2021-12-09T13:15:33");
121
+ it('respects the `time` option', () => {
122
+ timezoneMock.register('UTC');
123
+ const testDate = new Date('2021-12-09T13:15:33');
148
124
  const today = new Date();
149
125
  today.setHours(15);
150
126
  today.setMinutes(22);
151
- window.i18next.language = "en";
152
- expect(formatDate(testDate)).toEqual("09-Dec-2021");
153
- expect(formatDate(testDate, { time: true })).toMatch(
154
- /09-Dec-2021,\s01:15\sPM/
155
- );
156
- expect(formatDate(testDate, { time: false })).toEqual("09-Dec-2021");
157
- expect(formatDate(testDate, { time: "for today" })).toEqual("09-Dec-2021");
127
+ window.i18next.language = 'en';
128
+ expect(formatDate(testDate)).toEqual('09-Dec-2021');
129
+ expect(formatDate(testDate, { time: true })).toMatch(/09-Dec-2021,\s01:15\sPM/);
130
+ expect(formatDate(testDate, { time: false })).toEqual('09-Dec-2021');
131
+ expect(formatDate(testDate, { time: 'for today' })).toEqual('09-Dec-2021');
158
132
  expect(formatDate(today, { time: true })).toMatch(/Today,\s03:22\sPM/);
159
- expect(formatDate(today, { time: false })).toEqual("Today");
160
- expect(formatDate(today, { time: "for today" })).toMatch(
161
- /Today, 03:22\sPM/
162
- );
133
+ expect(formatDate(today, { time: false })).toEqual('Today');
134
+ expect(formatDate(today, { time: 'for today' })).toMatch(/Today, 03:22\sPM/);
163
135
  });
164
136
 
165
- it("formats times with respect to the locale", () => {
166
- timezoneMock.register("Australia/Adelaide");
167
- const testDate = new Date("2021-12-09T13:15:33");
168
- window.i18next.language = "en";
137
+ it('formats times with respect to the locale', () => {
138
+ timezoneMock.register('Australia/Adelaide');
139
+ const testDate = new Date('2021-12-09T13:15:33');
140
+ window.i18next.language = 'en';
169
141
  expect(formatTime(testDate)).toMatch(/01:15\sPM/i);
170
- window.i18next.language = "es-CO";
142
+ window.i18next.language = 'es-CO';
171
143
  expect(formatTime(testDate)).toMatch(/1:15\sp.\sm./); // it's not a normal space between the 'p.' and 'm.'
172
- window.i18next.language = "es-MX";
173
- expect(formatTime(testDate)).toEqual("13:15");
144
+ window.i18next.language = 'es-MX';
145
+ expect(formatTime(testDate)).toEqual('13:15');
174
146
  });
175
147
 
176
- it("formats datetimes with respect to the locale", () => {
177
- timezoneMock.register("US/Pacific");
178
- const testDate = new Date("2022-02-09T13:15:33");
148
+ it('formats datetimes with respect to the locale', () => {
149
+ timezoneMock.register('US/Pacific');
150
+ const testDate = new Date('2022-02-09T13:15:33');
179
151
  const todayDate = new Date();
180
152
  todayDate.setHours(15);
181
153
  todayDate.setMinutes(20);
182
- window.i18next.language = "en";
154
+ window.i18next.language = 'en';
183
155
  expect(formatDatetime(testDate)).toMatch(/09-Feb-2022,\s01:15\sPM/i);
184
156
  expect(formatDatetime(todayDate)).toMatch(/Today,\s03:20\sPM/i);
185
- window.i18next.language = "ht";
186
- expect(formatDatetime(testDate)).toEqual("09 févr. 2022, 13:15");
187
- expect(formatDatetime(todayDate)).toEqual("Aujourd’hui, 15:20");
157
+ window.i18next.language = 'ht';
158
+ expect(formatDatetime(testDate)).toEqual('09 févr. 2022, 13:15');
159
+ expect(formatDatetime(todayDate)).toEqual('Aujourd’hui, 15:20');
188
160
  });
189
161
 
190
- it("does not handle today specially when `noToday` is passed", () => {
162
+ it('does not handle today specially when `noToday` is passed', () => {
191
163
  const testDate = new Date();
192
164
  testDate.setHours(15);
193
165
  testDate.setMinutes(22);
194
- window.i18next.language = "en";
166
+ window.i18next.language = 'en';
195
167
  const expected =
196
168
  testDate
197
- .toLocaleDateString("en-GB", {
198
- year: "numeric",
199
- month: "short",
200
- day: "2-digit",
169
+ .toLocaleDateString('en-GB', {
170
+ year: 'numeric',
171
+ month: 'short',
172
+ day: '2-digit',
201
173
  })
202
- .replace(/ /g, "-") + ", 03:22 PM";
203
- expect(
204
- formatDate(testDate, { noToday: true }).replaceAll(/[\u202F]/g, " ")
205
- ).toEqual(expected);
174
+ .replace(/ /g, '-') + ', 03:22 PM';
175
+ expect(formatDate(testDate, { noToday: true }).replaceAll(/[\u202F]/g, ' ')).toEqual(expected);
206
176
  });
207
177
  });