Squashed commit of the following:

commit dfc79cf287823383a25a650d5788ee5250b1c316
Author: GuillaumeSD <47183782+GuillaumeSD@users.noreply.github.com>
Date:   Sun May 11 01:32:35 2025 +0200

    fix : style

commit bccfa5a3358302c2f037cc2dcfbd0a1df5e2974e
Author: GuillaumeSD <47183782+GuillaumeSD@users.noreply.github.com>
Date:   Sun May 11 01:01:12 2025 +0200

    feat : players clocks v1

commit 5f65009f200686433904710d5f9ceb1ba166fa9d
Author: GuillaumeSD <47183782+GuillaumeSD@users.noreply.github.com>
Date:   Sat May 10 21:58:02 2025 +0200

    fix : merge issues

commit f93dc6104e2d3fbb60088f578c2d1f13bf6519e9
Merge: a9f3728 fea1f3f
Author: GuillaumeSD <47183782+GuillaumeSD@users.noreply.github.com>
Date:   Sat May 10 21:53:11 2025 +0200

    Merge branch 'main' into feat/add-players-clocks

commit a9f372808ef403dfb823c4cf93c837412cc55c53
Author: GuillaumeSD <gsd.lfny@gmail.com>
Date:   Mon Jan 6 23:10:28 2025 +0100

    fix : rename

commit aedf9c252023bebe4da4327b7526371fa75b7b3e
Author: GuillaumeSD <gsd.lfny@gmail.com>
Date:   Sun Jan 5 17:30:27 2025 +0100

    feat : add players clocks
This commit is contained in:
GuillaumeSD
2025-05-11 01:33:10 +02:00
parent fea1f3fe47
commit 74a2adbb7d
17 changed files with 169 additions and 57 deletions

View File

@@ -1,5 +1,5 @@
import { ChessComGame } from "@/types/chessCom";
import { getPaddedMonth } from "./helpers";
import { getPaddedNumber } from "./helpers";
export const getChessComUserRecentGames = async (
username: string
@@ -7,7 +7,7 @@ export const getChessComUserRecentGames = async (
const date = new Date();
const year = date.getUTCFullYear();
const month = date.getUTCMonth() + 1;
const paddedMonth = getPaddedMonth(month);
const paddedMonth = getPaddedNumber(month);
const res = await fetch(
`https://api.chess.com/pub/player/${username}/games/${year}/${paddedMonth}`
@@ -21,7 +21,7 @@ export const getChessComUserRecentGames = async (
if (games.length < 50) {
const previousMonth = month === 1 ? 12 : month - 1;
const previousPaddedMonth = getPaddedMonth(previousMonth);
const previousPaddedMonth = getPaddedNumber(previousMonth);
const yearToFetch = previousMonth === 12 ? year - 1 : year;
const resPreviousMonth = await fetch(