diff --git a/package.json b/package.json index 07f92cd..94001c6 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "@vanilla-extract/css": "^1.7.2", "@vanilla-extract/next-plugin": "^2.0.2", "@visx/scale": "^2.2.2", + "date-fns": "^2.29.3", "marked": "^4.0.18", "next": "12.2.5", "react": "18.2.0", diff --git a/utils/elo.ts b/utils/elo.ts index ec169a0..67bbd1f 100644 --- a/utils/elo.ts +++ b/utils/elo.ts @@ -14,6 +14,7 @@ type Config = { type Comparison = { entities: [string, string]; result: number; + date: string; }; /** @@ -54,7 +55,7 @@ const calculateStats = (tournament: EloTournament) => { for (let entity of tournament.entities) { result[entity] = { comparisons: 0, - rating: initialRating + rating: initialRating, }; } diff --git a/utils/useIssues.ts b/utils/useIssues.ts index e769fea..c20bb46 100644 --- a/utils/useIssues.ts +++ b/utils/useIssues.ts @@ -4,6 +4,7 @@ import { EloTournament } from "./elo"; import getStats from "./getStats"; import { getIssue, IssueDetail, IssueSummary } from "./linear"; import weightedRandomPick from "./weightedRandomPick"; +import formatISO from "date-fns/formatISO"; const useIssues = ( credentials: Credentials, @@ -60,7 +61,7 @@ const useIssues = ( const comparisons: EloTournament["comparisons"] = JSON.parse( window.localStorage.getItem(localStorageKey) ?? "[]" ); - comparisons.push({ entities, result }); + comparisons.push({ entities, result, date: formatISO(new Date()) }); window.localStorage.setItem(localStorageKey, JSON.stringify(comparisons)); }; diff --git a/yarn.lock b/yarn.lock index 26a3e3f..539dae0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -647,6 +647,11 @@ damerau-levenshtein@^1.0.8: resolved "https://registry.yarnpkg.com/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz#b43d286ccbd36bc5b2f7ed41caf2d0aba1f8a6e7" integrity sha512-sdQSFB7+llfUcQHUQO3+B8ERRj0Oa4w9POWMI/puGtuf7gFywGmkaLCElnudfTiKZV+NvHqL0ifzdrI8Ro7ESA== +date-fns@^2.29.3: + version "2.29.3" + resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.29.3.tgz#27402d2fc67eb442b511b70bbdf98e6411cd68a8" + integrity sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA== + debug@^2.6.9: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"