Topic: how to pas default date in mdbootstrap calendar

Stylezst premium asked 2 years ago

hi, i wanted to go to the specific date from the api i've been using. but i'm unable to pas the date. can you please send me the exact code how to wrtite. i'm attaching a sample.

const calendarElement = document.getElementById('calendar-6'); const calendarInstance = Calendar.getInstance(calendarElement, { defaultDate: '07-07-2022' }); calendarInstance.addEvents(events);

Grzegorz Bujański staff answered 2 years ago

The calendar plugin has auto initialization implemented. It takes place on every element with the calendar class. The defaultDate option can only be set at component initialization. Therefore, by default, we suggest you set it using data attributes. I have created a snippet for you that allows you to bypass auto initialization and do it manually:

Grzegorz Bujański staff answered 2 years ago

getInstance method is used to get an instance, not to pass an option. Here is an example of the default date setting:

Stylezst premium commented 2 years ago

how to pass the option using js. actually i wanted to pass the defaultDate using js

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

  • ForumUser: Premium
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 3.11.0
  • Device: Dell
  • Browser: Chrome
  • OS: Windows
  • Provided sample code: No
  • Provided link: No