dance2die / calendar-dates

📆 Get a list of calendar dates with no external dependencies.
https://www.npmjs.com/package/calendar-dates
MIT License
14 stars 3 forks source link

Invalid getMatrix results #31

Closed ewolfe closed 5 years ago

ewolfe commented 5 years ago

Hey @dance2die! Found a slight issue:

Steps to reproduce

https://codesandbox.io/s/lx77w00ymz

const CalendarDates = require("calendar-dates");
const calendarDates = new CalendarDates();
const january = new Date("2019-01-31T08:00:00.000Z");

const mainAsync = async () => {
  const janMatrix = await calendarDates.getMatrix(january);
  console.log("janMatrix[0][0].iso: ", janMatrix[0][0].iso); // "2019-00-30"
  console.assert(janMatrix[0][0].iso === "2018-12-30", {
    expected: "2018-12-30",
    actual: janMatrix[0][0].iso
  });
};
mainAsync();

I can take a stab at fixing it, but wanted to at least get the issue open :)

dance2die commented 5 years ago

It does look like a problem as the returned ISO month is "0" instead of "12". It seems like I messed up while fixing #26 😛

image https://runkit.com/dance2die/5c3933a4f6467f0012c25964

Would you mind taking a stab at fixing it? 😄