Format datetimes using i18n lang

This commit is contained in:
nimbleghost
2023-07-03 15:24:13 +02:00
parent 7a1488fcd3
commit 311ffc3672
5 changed files with 25 additions and 19 deletions

View File

@@ -160,10 +160,10 @@ const autolink = (s) => {
};
const NotificationItem = (props) => {
const { t } = useTranslation();
const { t, i18n } = useTranslation();
const { notification } = props;
const { attachment } = notification;
const date = formatShortDateTime(notification.time);
const date = formatShortDateTime(notification.time, i18n.language);
const otherTags = unmatchedTags(notification.tags);
const tags = otherTags.length > 0 ? otherTags.join(", ") : null;
const handleDelete = async () => {
@@ -277,7 +277,7 @@ const NotificationItem = (props) => {
};
const Attachment = (props) => {
const { t } = useTranslation();
const { t, i18n } = useTranslation();
const { attachment } = props;
const expired = attachment.expires && attachment.expires < Date.now() / 1000;
const expires = attachment.expires && attachment.expires > Date.now() / 1000;
@@ -296,7 +296,7 @@ const Attachment = (props) => {
if (expires) {
infos.push(
t("notifications_attachment_link_expires", {
date: formatShortDateTime(attachment.expires),
date: formatShortDateTime(attachment.expires, i18n.language),
})
);
}