feat(post): choose date/time format from translations locale

This commit is contained in:
plebeius.eth
2024-05-06 16:17:22 +02:00
parent 4756c09796
commit d9ac34ef0f
+3 -1
View File
@@ -1,8 +1,10 @@
import i18next from 'i18next';
export const getFormattedDate = (commentTimestamp: number) => {
if (commentTimestamp === undefined || isNaN(commentTimestamp)) {
return '';
}
const locale = Intl.DateTimeFormat().resolvedOptions().locale;
const locale = i18next.language || 'en';
const string = new Intl.DateTimeFormat(locale, {
hour12: false,
year: '2-digit',