From f4ee88c075541e099d92e75e07dd4b2b204517d3 Mon Sep 17 00:00:00 2001 From: Zamitto Date: Wed, 1 May 2024 19:55:31 -0300 Subject: [PATCH] format date based on user language --- src/renderer/src/pages/game-details/hero-panel.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/renderer/src/pages/game-details/hero-panel.tsx b/src/renderer/src/pages/game-details/hero-panel.tsx index 826142ef..fafd0aaa 100644 --- a/src/renderer/src/pages/game-details/hero-panel.tsx +++ b/src/renderer/src/pages/game-details/hero-panel.tsx @@ -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(() => {