1
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:
2022-04-22 14:37:35 -04:00
parent 8a97b706be
commit fbb2221d08
10 changed files with 78 additions and 58 deletions
+7 -1
View File
@@ -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;
}
};