diff options
| author | Brendan F <EpicWolverine@users.noreply.github.com> | 2023-06-25 22:22:37 -0700 |
|---|---|---|
| committer | Brendan F <EpicWolverine@users.noreply.github.com> | 2023-06-25 22:22:37 -0700 |
| commit | 53939633d070ff498fbb9ae2f26a0be0317efee6 (patch) | |
| tree | b93c5584420f1b8941b87b040cbf12ab7fa16a5f /src | |
| parent | ad00fd35b1335a54f3e2d45b808ee816672d5af3 (diff) | |
Move startDate to one defined spot
Diffstat (limited to 'src')
| -rw-r--r-- | src/constants/index.ts | 1 | ||||
| -rw-r--r-- | src/constants/startDate.ts | 1 | ||||
| -rw-r--r-- | src/helpers/scoreToEmoji.ts | 2 | ||||
| -rw-r--r-- | src/helpers/todaysSolution.ts | 3 |
4 files changed, 4 insertions, 3 deletions
diff --git a/src/constants/index.ts b/src/constants/index.ts index d396519..00507bd 100644 --- a/src/constants/index.ts +++ b/src/constants/index.ts @@ -1,3 +1,4 @@ export { playTimes } from "./playTimes"; export { songs } from "./songs"; +export { startDate } from "./startDate"; export { theme } from "./theme"; diff --git a/src/constants/startDate.ts b/src/constants/startDate.ts new file mode 100644 index 0000000..d0fe930 --- /dev/null +++ b/src/constants/startDate.ts @@ -0,0 +1 @@ +export const startDate = new Date('5/5/2023'); diff --git a/src/helpers/scoreToEmoji.ts b/src/helpers/scoreToEmoji.ts index ffc2fe2..fd55627 100644 --- a/src/helpers/scoreToEmoji.ts +++ b/src/helpers/scoreToEmoji.ts @@ -1,8 +1,8 @@ import { GuessType } from "../types/guess"; +import { startDate } from "../constants"; export function scoreToEmoji(guesses: GuessType[]): string { const msInDay = 86400000; - const startDate = new Date('5/5/2023'); const todaysDate = new Date(); const index = Math.floor((todaysDate.getTime() - startDate.getTime() )/msInDay) + 1 const emojis = { diff --git a/src/helpers/todaysSolution.ts b/src/helpers/todaysSolution.ts index 50e75ce..32760cb 100644 --- a/src/helpers/todaysSolution.ts +++ b/src/helpers/todaysSolution.ts @@ -1,11 +1,10 @@ -import { songs } from "../constants"; +import { songs, startDate } from "../constants"; // const epochMs = new Date(2022, 3, 10).valueOf(); // const now = Date.now(); // const index = Math.floor((now - epochMs) / msInDay); const msInDay = 86400000; -const startDate = new Date('4/15/2022'); const todaysDate = new Date(); const index = Math.floor((todaysDate.getTime() - startDate.getTime() )/msInDay) |
