Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bulma Calendar - maxDate throws an error #219

Closed
babajidemm-bd opened this issue Dec 3, 2019 · 3 comments
Closed

Bulma Calendar - maxDate throws an error #219

babajidemm-bd opened this issue Dec 3, 2019 · 3 comments

Comments

@babajidemm-bd
Copy link

babajidemm-bd commented Dec 3, 2019

Bug Report

Source
https://cdn.jsdelivr.net/npm/[email protected]/bulma-calendar/dist/js/bulma-calendar.min.js

Environment

  • Bulma version: v6.2.7
  • OS: [e.g. OSX 10.13.4, Windows 10]
  • Browser: Chrome XX (I have not tested other browsers but I guess this bug is not browser specific)
  • How you are customizing the extension: no

Current Behavior

Uncaught RangeError: Invalid array length
    at datePicker._renderDays (bulma-calendar.min.js:1)
    at datePicker.refresh (bulma-calendar.min.js:1)
    at datePicker.render (bulma-calendar.min.js:1)
    at bulmaCalendar._build (bulma-calendar.min.js:1)
    at bulmaCalendar._init (bulma-calendar.min.js:1)
    at new bulmaCalendar (bulma-calendar.min.js:1)
    at bulma-calendar.min.js:1
    at NodeList.forEach (<anonymous>)
    at Function.attach (bulma-calendar.min.js:1)
    ...

Input Code

  • Initialization code:
bulmaCalendar.attach('input[name="birth_date"][type=date]', {
            type: 'date',
            maxDate: new Date(),
        });

Steps to reproduce
See input/initialization code above

@johannesE
Copy link

I get the exact same error, but only for my first date field on the page and only in chrome. I'm not setting maxDate at all. Using the workaround described in #211 does not change anything.

let lang = window.navigator.language || 'de';

  const calendars = bulmaCalendar.attach('[type="date"]', {
    lang: lang,
    dateFormat: 'YYYY-MM-DD',
    weekStart: 1
  });

@zafranf
Copy link

zafranf commented Dec 8, 2020

i fix this by using tomorrow and disable the tomorrow..

    let tomorrow = new Date();
    tomorrow.setTime(tomorrow.getTime() + 86400000);
    let calendars = bulmaCalendar.attach('[type="date"]', {
      maxDate: tomorrow,
      disabledDates: [tomorrow],
      ...
    })

@michael-hack
Copy link
Owner

Should be fixed with 6.1.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants