color-calendar icon indicating copy to clipboard operation
color-calendar copied to clipboard

Events longer than 1 month are not displayed

Open VChet opened this issue 4 years ago • 1 comments

Events that start on one month and end on another are not being displayed at all. In the reproduction code there are three events, 1 day long, 1 week long and 1 month long, but only the first two are in the calendar.

Reproduction code
<!DOCTYPE html>
<html lang="en">
<head>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/color-calendar/dist/css/theme-basic.css" />
  <script src="https://cdn.jsdelivr.net/npm/color-calendar/dist/bundle.js"></script>
</head>
<body>
  <div id="color-calendar"></div>
  <div class="dayEvents"></div>
  <script>
    const today = new Date();
    const eventsData = [
      { start: today, end: today, name: "one day event" },
      { start: today, end: new Date(new Date(today.getTime() + 7 * 24 * 60 * 60 * 1000)), name: "one week event" },
      { start: today, end: new Date(new Date(today.getTime() + 30 * 24 * 60 * 60 * 1000)), name: "one month event" },
    ];
    new Calendar({
      id: "#color-calendar",
      calendarSize: "large",
      eventsData,
      dateChanged: (_date, events) => {
        document.querySelector(".dayEvents").innerText = JSON.stringify(events, null, "  ");
      },
    });
  </script>
</body>
</html>

Same code on codepen.io

VChet avatar Jan 15 '22 12:01 VChet

Duplicate of #17 and possible fix is in #18 (some cleanup needed).

@PawanKolhe can we please get you back to push this important bugfix? 😁 Thank you for this great piece of code.

razvanphp avatar Dec 16 '22 21:12 razvanphp