mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2026-04-21 12:25:31 -04:00
switch from date-fns (and date-fns-tz) to dayjs
This commit is contained in:
@@ -2,4 +2,10 @@ import { siteLocale } from "../config";
|
||||
|
||||
// adds thousands separator
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat
|
||||
export const commafy = Intl.NumberFormat(siteLocale, { useGrouping: true }).format;
|
||||
export const commafy = (number: number) => {
|
||||
if (typeof Intl !== "undefined" && typeof Intl.NumberFormat !== "undefined") {
|
||||
return new Intl.NumberFormat(siteLocale, { useGrouping: true }).format(number);
|
||||
} else {
|
||||
return number;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user