fix: dates follow the UI language, not the browser's
Seven sites formatted with a bare toLocaleString()/toLocaleDateString(), so an English UI on a Hungarian machine printed Hungarian-shaped dates (and the reverse). They now go through formatDateTime/formatDate, which take the i18n language.
This commit is contained in:
@@ -9,6 +9,7 @@ import { useConfirm } from "./ConfirmProvider";
|
||||
import { notify } from "../lib/notifications";
|
||||
import { notifyActionError } from "../lib/actionErrors";
|
||||
import { copyText } from "../lib/clipboard";
|
||||
import { formatDate } from "../lib/format";
|
||||
import { api, type DownloadJob, type ShareLink } from "../lib/api";
|
||||
import { inputCls } from "./ui/form";
|
||||
import { Button } from "./ui/Button";
|
||||
@@ -88,7 +89,7 @@ function UserShare({ job }: { job: DownloadJob }) {
|
||||
// --- share by public link -------------------------------------------------------------------
|
||||
|
||||
function LinkRow({ link, onChanged }: { link: ShareLink; onChanged: () => void }) {
|
||||
const { t } = useTranslation();
|
||||
const { t, i18n } = useTranslation();
|
||||
const confirm = useConfirm();
|
||||
const [copied, setCopied] = useState(false);
|
||||
const [editPass, setEditPass] = useState(false);
|
||||
@@ -130,7 +131,7 @@ function LinkRow({ link, onChanged }: { link: ShareLink; onChanged: () => void }
|
||||
if (link.allow_download) badges.push(t("downloads.share.downloadable"));
|
||||
if (link.expires_at)
|
||||
badges.push(
|
||||
t("downloads.share.expiresOn", { date: new Date(link.expires_at).toLocaleDateString() }),
|
||||
t("downloads.share.expiresOn", { date: formatDate(link.expires_at, i18n.language) }),
|
||||
);
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user