fix: fixing date on backup upload

This commit is contained in:
Chubby Granny Chaser
2025-04-17 23:44:25 +01:00
parent d0ac819da5
commit 8c66b9a499
2 changed files with 5 additions and 11 deletions

View File

@@ -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"),
})
);
};

View File

@@ -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"),
})
);
}