this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Prioritize Intl's locale instead of navigator.languages

+5 -4
+1 -1
src/utils/date-time-format.js
··· 6 6 try { 7 7 const dtfLocale = new Intl.DateTimeFormat().resolvedOptions().locale; 8 8 if (!newLocales.includes(dtfLocale)) { 9 - newLocales.push(dtfLocale); 9 + newLocales.unshift(dtfLocale); 10 10 } 11 11 } catch {} 12 12 return newLocales;
+4 -3
tests/date-time-format.spec.js
··· 95 95 expect(navigator.language).toBe('en-GB'); 96 96 expect(formatted).toBeTruthy(); 97 97 98 - // Verify that the DateTimeFormat uses en-GB (British formatting) 98 + // Verify the negotiation: 99 + // Environment default may be prioritized by implementation, otherwise user region should be respected. 99 100 const resolvedLocale = dtf.resolvedOptions().locale; 100 - // Should resolve to en-GB since the locale combination logic works 101 - expect(resolvedLocale).toBe('en-GB'); 101 + const envDefault = new Intl.DateTimeFormat().resolvedOptions().locale; 102 + expect([envDefault, 'en-GB', 'en']).toContain(resolvedLocale); 102 103 }); 103 104 104 105 test('should handle different formatting options', () => {