- {formatShortDateTime(token.last_access)}
+ {formatShortDateTime(token.last_access, i18n.language)}
{
};
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),
})
);
}
diff --git a/web/src/components/SubscriptionPopup.jsx b/web/src/components/SubscriptionPopup.jsx
index 17b12504..1a6a689c 100644
--- a/web/src/components/SubscriptionPopup.jsx
+++ b/web/src/components/SubscriptionPopup.jsx
@@ -117,10 +117,16 @@ export const SubscriptionPopup = (props) => {
])[0];
const nowSeconds = Math.round(Date.now() / 1000);
const message = shuffle([
- `Hello friend, this is a test notification from ntfy web. It's ${formatShortDateTime(nowSeconds)} right now. Is that early or late?`,
+ `Hello friend, this is a test notification from ntfy web. It's ${formatShortDateTime(
+ nowSeconds,
+ "en-US"
+ )} right now. Is that early or late?`,
`So I heard you like ntfy? If that's true, go to GitHub and star it, or to the Play store and rate it. Thanks! Oh yeah, this is a test notification.`,
`It's almost like you want to hear what I have to say. I'm not even a machine. I'm just a sentence that Phil typed on a random Thursday.`,
- `Alright then, it's ${formatShortDateTime(nowSeconds)} already. Boy oh boy, where did the time go? I hope you're alright, friend.`,
+ `Alright then, it's ${formatShortDateTime(
+ nowSeconds,
+ "en-US"
+ )} already. Boy oh boy, where did the time go? I hope you're alright, friend.`,
`There are nine million bicycles in Beijing That's a fact; It's a thing we can't deny. I wonder if that's true ...`,
`I'm really excited that you're trying out ntfy. Did you know that there are a few public topics, such as ntfy.sh/stats and ntfy.sh/announcements.`,
`It's interesting to hear what people use ntfy for. I've heard people talk about using it for so many cool things. What do you use it for?`,
diff --git a/web/src/components/UpgradeDialog.jsx b/web/src/components/UpgradeDialog.jsx
index 4bf0244d..712c47ec 100644
--- a/web/src/components/UpgradeDialog.jsx
+++ b/web/src/components/UpgradeDialog.jsx
@@ -62,7 +62,7 @@ const Banner = {
const UpgradeDialog = (props) => {
const theme = useTheme();
- const { t } = useTranslation();
+ const { t, i18n } = useTranslation();
const { account } = useContext(AccountContext); // May be undefined!
const [error, setError] = useState("");
const [tiers, setTiers] = useState(null);
@@ -233,7 +233,7 @@ const UpgradeDialog = (props) => {