Topic: Calendar ignoring javascript instance

Macjohn free asked 2 years ago

Expected behavior Ability to instantiate calendar via javascript

Actual behavior No calendar via javascript. Canlendar only showing if I use data-mdb attributes.

Resources (screenshots, code snippets etc.)

This works:


This does not work.

<div id='calendar'></div>

with this javascript:

const calendarElement = document.getElementById('calendar');
const instance = Calendar.getInstance(calendarElement, {
    mondayFirst: true,

As soon as I add the class 'calendar' it works, but it is ignoring the javascript options. The javascript is loaded, and it is loaded after mdb. Can you help?

Macjohn free answered 2 years ago

OK great - thanks. That works for now.

Grzegorz Bujański staff answered 2 years ago

Thanks for reporting a bug. We'll fix it. As a workaround, use this code:

<div id='calendar'></div>

const calendarElement = document.getElementById('calendar');
const instance = new Calendar(calendarElement, {
  mondayFirst: true;

btgdev priority commented 1 month ago

Hello! Has there been a resolution for this? Your workaround works fine, and I'm fine with using the workaround, but I wanted to make sure I wasn't otherwise causing a problem by continuing to use the workaround.

Kamila Pieńkowska staff commented 1 month ago

We did not change that. This method is still valid.

Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.



Specification of the issue

  • User: Free
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: 3.2.0
  • Device: Any
  • Browser: Any
  • OS: Any
  • Provided sample code: No
  • Provided link: No