fix: Problem when using Brazilian Portuguese (#7135)

Fixes:  #7127
This commit is contained in:
Sivin Varghese
2023-05-19 20:55:01 +05:30
committed by GitHub
parent 8b3d13a920
commit 1bcc438b21
2 changed files with 56 additions and 11 deletions

View File

@@ -32,7 +32,8 @@ export const isTimeAfter = (h1, m1, h2, m2) => {
};
export const generateRelativeTime = (value, unit, languageCode) => {
const rtf = new Intl.RelativeTimeFormat(languageCode, {
const code = languageCode?.replace(/_/g, '-'); // Hacky fix we need to handle it from source
const rtf = new Intl.RelativeTimeFormat(code, {
numeric: 'auto',
});
return rtf.format(value, unit);