diff --git a/src/utils/nice-date-time.js b/src/utils/nice-date-time.js index ce349acc..33f9036f 100644 --- a/src/utils/nice-date-time.js +++ b/src/utils/nice-date-time.js @@ -1,9 +1,10 @@ +const { locale } = new Intl.DateTimeFormat().resolvedOptions(); + function niceDateTime(date, { hideTime, formatOpts } = {}) { if (!(date instanceof Date)) { date = new Date(date); } const currentYear = new Date().getFullYear(); - const locale = new Intl.DateTimeFormat().resolvedOptions().locale; const dateText = Intl.DateTimeFormat(locale, { // Show year if not current year year: date.getFullYear() === currentYear ? undefined : 'numeric', diff --git a/src/utils/shorten-number.jsx b/src/utils/shorten-number.jsx index 43dd0680..e165b716 100644 --- a/src/utils/shorten-number.jsx +++ b/src/utils/shorten-number.jsx @@ -1,5 +1,7 @@ +const { locale } = Intl.NumberFormat().resolvedOptions(); + export default function shortenNumber(num) { - return Intl.NumberFormat('en-US', { + return Intl.NumberFormat(locale, { notation: 'compact', }).format(num); }