-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from spence-m/wotlk
Add Wrath of the Lich King calendar.
- Loading branch information
Showing
9 changed files
with
9,123 additions
and
797 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
export const wrathDates = [ | ||
[ | ||
{ | ||
key: "arathi", | ||
date: new Date(2022, 8, 30), // sept | ||
}, | ||
{ | ||
key: "strand", | ||
date: new Date(2022, 9, 7), // oct | ||
}, | ||
{ | ||
key: "alterac", | ||
date: new Date(2022, 9, 14), // oct | ||
}, | ||
{ | ||
key: "eye", | ||
date: new Date(2022, 9, 21), // oct | ||
}, | ||
{ | ||
key: "warsong", | ||
date: new Date(2022, 9, 28), // oct | ||
}, | ||
], | ||
[ | ||
{ | ||
key: "arathi", | ||
date: new Date(2022, 10, 4), // nov | ||
}, | ||
{ | ||
key: "strand", | ||
date: new Date(2022, 10, 11), // nov | ||
}, | ||
{ | ||
key: "alterac", | ||
date: new Date(2022, 10, 18), // nov | ||
}, | ||
{ | ||
key: "eye", | ||
date: new Date(2022, 10, 25), // nov | ||
}, | ||
{ | ||
key: "warsong", | ||
date: new Date(2022, 11, 2), // dec | ||
}, | ||
], | ||
[ | ||
{ | ||
key: "arathi", | ||
date: new Date(2022, 11, 9), // dec | ||
}, | ||
{ | ||
key: "strand", | ||
date: new Date(2022, 11, 16), // dec | ||
}, | ||
{ | ||
key: "alterac", | ||
date: new Date(2022, 11, 23), // dec | ||
}, | ||
{ | ||
key: "eye", | ||
date: new Date(2022, 11, 30), // dec | ||
}, | ||
{ | ||
key: "warsong", | ||
date: "", | ||
}, | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { wrathDates } from "../__fixtures__/wotlk-dates.js"; | ||
import { getWOTLKHolidays } from "../helpers/date-helper.js"; | ||
|
||
it("should contain the correct WOTLK dates for 2022", () => { | ||
const holidays = getWOTLKHolidays(2022); | ||
for (let i = 0; i < holidays.length; i++) { | ||
for (let j = 0; j < holidays[i].length; j++) { | ||
const firstKey = wrathDates[i][j].key; | ||
const secondKey = holidays[i][j].key; | ||
|
||
const firstDateStr = | ||
wrathDates[i][j].date === "" | ||
? wrathDates[i][j].date | ||
: wrathDates[i][j].date.toLocaleDateString(); | ||
const secondDateStr = | ||
holidays[i][j].date === "" | ||
? holidays[i][j].date | ||
: holidays[i][j].date.toLocaleDateString(); | ||
|
||
expect(firstKey).toEqual(secondKey); | ||
expect(firstDateStr).toEqual(secondDateStr); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"presets": [ | ||
[ | ||
"@babel/preset-env", | ||
{ | ||
"targets": { | ||
"node": "current" | ||
} | ||
} | ||
] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
export const getWOTLKHolidays = (year) => { | ||
const arathiEpoch = new Date(2022, 8, 30); | ||
const strandEpoch = new Date(2022, 9, 7); | ||
const alteracEpoch = new Date(2022, 9, 14); | ||
const eyeOfTheStormEpoch = new Date(2022, 9, 21); | ||
const warsongEpoch = new Date(2022, 9, 28); | ||
const start = new Date(arathiEpoch.getTime()); | ||
|
||
let i = 0; | ||
const dates = []; | ||
while (start.getFullYear() <= year) { | ||
const row = [ | ||
{ | ||
key: "arathi", | ||
date: "", | ||
}, | ||
{ | ||
key: "strand", | ||
date: "", | ||
}, | ||
{ | ||
key: "alterac", | ||
date: "", | ||
}, | ||
{ | ||
key: "eye", | ||
date: "", | ||
}, | ||
{ | ||
key: "warsong", | ||
date: "", | ||
}, | ||
]; | ||
|
||
const fiveWeeksInDays = 35; | ||
const arathiDate = new Date(arathiEpoch); | ||
arathiDate.setDate(arathiDate.getDate() + fiveWeeksInDays * i); | ||
|
||
const strandDate = new Date(strandEpoch); | ||
strandDate.setDate(strandDate.getDate() + fiveWeeksInDays * i); | ||
|
||
const alteracDate = new Date(alteracEpoch); | ||
alteracDate.setDate(alteracDate.getDate() + fiveWeeksInDays * i); | ||
|
||
const eyeOfTheStormDate = new Date(eyeOfTheStormEpoch); | ||
eyeOfTheStormDate.setDate( | ||
eyeOfTheStormDate.getDate() + fiveWeeksInDays * i | ||
); | ||
|
||
const warsongDate = new Date(warsongEpoch); | ||
warsongDate.setDate(warsongDate.getDate() + fiveWeeksInDays * i); | ||
|
||
let added = false; | ||
if (arathiDate.getFullYear() === year) { | ||
row[0].date = arathiDate; | ||
added = true; | ||
} | ||
if (strandDate.getFullYear() === year) { | ||
row[1].date = strandDate; | ||
added = true; | ||
} | ||
if (alteracDate.getFullYear() === year) { | ||
row[2].date = alteracDate; | ||
added = true; | ||
} | ||
if (eyeOfTheStormDate.getFullYear() === year) { | ||
row[3].date = eyeOfTheStormDate; | ||
added = true; | ||
} | ||
if (warsongDate.getFullYear() === year) { | ||
row[4].date = warsongDate; | ||
added = true; | ||
} | ||
|
||
if (added) { | ||
dates.push(row); | ||
} | ||
start.setDate(start.getDate() + fiveWeeksInDays); | ||
i++; | ||
} | ||
|
||
return dates; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.