format date based on user language

This commit is contained in:
Zamitto 2024-05-01 19:55:31 -03:00
parent cfdd09d9ac
commit f4ee88c075

View file

@ -29,7 +29,7 @@ export function HeroPanel({
getGame,
isGamePlaying,
}: HeroPanelProps) {
const { t } = useTranslation("game_details");
const { t, i18n } = useTranslation("game_details");
const [showBinaryNotFoundModal, setShowBinaryNotFoundModal] = useState(false);
const [lastTimePlayed, setLastTimePlayed] = useState("");
@ -65,8 +65,10 @@ export function HeroPanel({
return minutes.toFixed(0) + " " + t("minutes")
}
const numberFormat = new Intl.NumberFormat(i18n.language, { maximumFractionDigits: 1 })
const hours = minutes / 60
return hours.toFixed(1) + " " + t("hours")
return numberFormat.format(hours) + " " + t("hours")
}
const finalDownloadSize = useMemo(() => {