diff --git a/commands/events/calendar.js b/commands/events/calendar.js index 3c56e9bd..58991cf9 100644 --- a/commands/events/calendar.js +++ b/commands/events/calendar.js @@ -36,7 +36,7 @@ module.exports = class CalendarCommand extends Command { ------------------------------------ `; display += '\n'; - const startDay = new Date(`${month}/1/${year}`).getDay(); + const startDay = new Date(year, month - 1, 1).getDay(); for (let i = 0; i < startDay; i++) { display += ' '; } diff --git a/commands/events/days-since.js b/commands/events/days-since.js index 7f6e9edb..05a30109 100644 --- a/commands/events/days-since.js +++ b/commands/events/days-since.js @@ -34,7 +34,7 @@ module.exports = class DaysSinceCommand extends Command { run(msg, { month, day, year }) { const now = new Date(); - const past = new Date(`${month}/${day}/${year}`); + const past = new Date(year, month - 1, day); const pastFormat = moment.utc(past).format('dddd, MMMM Do, YYYY'); const time = moment.duration(now - past); return msg.say(`There have been ${time.format('Y [years,] M [months and] d [days]')} since ${pastFormat}!`); diff --git a/commands/events/days-until.js b/commands/events/days-until.js index 63216fc3..8edc8bd8 100644 --- a/commands/events/days-until.js +++ b/commands/events/days-until.js @@ -31,7 +31,7 @@ module.exports = class DaysUntilCommand extends Command { const now = new Date(); let year = now.getMonth() + 1 <= month ? now.getFullYear() : now.getFullYear() + 1; if (month === now.getMonth() + 1 && now.getDate() >= day) ++year; - const future = new Date(`${month}/${day}/${year}`); + const future = new Date(year, month - 1, day); const futureFormat = moment.utc(future).format('dddd, MMMM Do, YYYY'); const time = moment.duration(future - now); const link = time.months() ? time.months() === 1 ? 'is' : 'are' : time.days() === 1 ? 'is' : 'are';