🐛 fix: Add localization updates and new utility functions

This commit is contained in:
web
2025-09-04 22:30:33 -07:00
parent e4fbd5c754
commit 4da59609b4
54 changed files with 424 additions and 112 deletions
+18
View File
@@ -1,5 +1,6 @@
import { locales, NEXT_PUBLIC_DEFAULT_LANGUAGE } from '@/config/constants';
import { isBrowser } from '@workspace/ui/utils';
import { intlFormat } from 'date-fns';
import Cookies from 'universal-cookie';
const cookies = new Cookies(null, {
@@ -49,3 +50,20 @@ export function Logout() {
location.href = `/`;
}
}
export function formatDate(date?: Date | number, showTime: boolean = true) {
if (!date) return;
const timeZone = localStorage.getItem('timezone') || 'UTC';
return intlFormat(date, {
year: 'numeric',
month: 'numeric',
day: 'numeric',
...(showTime && {
hour: 'numeric',
minute: 'numeric',
second: 'numeric',
}),
hour12: false,
timeZone,
});
}