From 8c66b9a499049347ef5e888adec3d943176fd6c0 Mon Sep 17 00:00:00 2001 From: Chubby Granny Chaser Date: Thu, 17 Apr 2025 23:44:25 +0100 Subject: [PATCH] fix: fixing date on backup upload --- src/main/events/cloud-save/upload-save-game.ts | 6 ++---- src/main/services/process-watcher.ts | 10 +++------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/main/events/cloud-save/upload-save-game.ts b/src/main/events/cloud-save/upload-save-game.ts index 891941a0..629ac127 100644 --- a/src/main/events/cloud-save/upload-save-game.ts +++ b/src/main/events/cloud-save/upload-save-game.ts @@ -1,7 +1,7 @@ import { CloudSync } from "@main/services"; import { registerEvent } from "../register-event"; import type { GameShop } from "@types"; -import i18next, { t } from "i18next"; +import { t } from "i18next"; import { formatDate } from "date-fns"; const uploadSaveGame = async ( @@ -10,15 +10,13 @@ const uploadSaveGame = async ( shop: GameShop, downloadOptionTitle: string | null ) => { - const { language } = i18next; - return CloudSync.uploadSaveGame( objectId, shop, downloadOptionTitle, t("backup_from", { ns: "game_details", - date: formatDate(new Date(), language), + date: formatDate(new Date(), "yyyy-MM-dd"), }) ); }; diff --git a/src/main/services/process-watcher.ts b/src/main/services/process-watcher.ts index de0e88da..24ab45ea 100644 --- a/src/main/services/process-watcher.ts +++ b/src/main/services/process-watcher.ts @@ -6,7 +6,7 @@ import axios from "axios"; import { exec } from "child_process"; import { ProcessPayload } from "./download/types"; import { gamesSublevel, levelKeys } from "@main/level"; -import i18next, { t } from "i18next"; +import { t } from "i18next"; import { CloudSync } from "./cloud-sync"; import { formatDate } from "date-fns"; @@ -229,8 +229,6 @@ function onOpenGame(game: Game) { if (game.remoteId) { updateGamePlaytime(game, 0, new Date()).catch(() => {}); - const { language } = i18next; - if (game.automaticCloudSync) { CloudSync.uploadSaveGame( game.objectId, @@ -238,7 +236,7 @@ function onOpenGame(game: Game) { null, t("automatic_backup_from", { ns: "game_details", - date: formatDate(new Date(), language), + date: formatDate(new Date(), "yyyy-MM-dd"), }) ); } @@ -298,8 +296,6 @@ const onCloseGame = (game: Game) => { )!; gamesPlaytime.delete(levelKeys.game(game.shop, game.objectId)); - const { language } = i18next; - if (game.remoteId) { updateGamePlaytime( game, @@ -314,7 +310,7 @@ const onCloseGame = (game: Game) => { null, t("automatic_backup_from", { ns: "game_details", - date: formatDate(new Date(), language), + date: formatDate(new Date(), "yyyy-MM-dd"), }) ); }