michael-hack / bulma-calendar

Bulma's extension to display a calendar
MIT License
287 stars 165 forks source link

maxDate not working #286

Closed harrim4n closed 2 years ago

harrim4n commented 2 years ago

Bug Report

Environment

Current Behavior If maxDate is set (regardless of setting via options on attach or via data-max-date), the calendar does not render.

Uncaught RangeError: Invalid time value
    format http://localhost:8000/static/bulma/extensions/bulma-calendar.js:7352
    a http://localhost:8000/static/bulma/extensions/bulma-calendar.js:59220
    a http://localhost:8000/static/bulma/extensions/bulma-calendar.js:59219
    refresh http://localhost:8000/static/bulma/extensions/bulma-calendar.js:58603
    render http://localhost:8000/static/bulma/extensions/bulma-calendar.js:58692
    _build http://localhost:8000/static/bulma/extensions/bulma-calendar.js:46512
    _init http://localhost:8000/static/bulma/extensions/bulma-calendar.js:46403
    bulmaCalendar http://localhost:8000/static/bulma/extensions/bulma-calendar.js:45925
    attach http://localhost:8000/static/bulma/extensions/bulma-calendar.js:46900
    attach http://localhost:8000/static/bulma/extensions/bulma-calendar.js:46898

Input Code

bulmaCalendar.attach('[type="date"],[type="datetime"],[type="time"]', {});

Possible Solution The issue seems to have something to do with the assignment of var monthLabels = new Array(12).... This doesn't work, the values are invalid.

Reproducer https://jsfiddle.net/tncuL3dh/

michael-hack commented 2 years ago

It seems, that this only happens with dates in the past. I'll have a look.

michael-hack commented 2 years ago

Fixed in 6.1.15