how to pas default date in mdbootstrap calendar


Topic: how to pas default date in mdbootstrap calendar

Stylezst pro premium asked 3 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 3 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: https://mdbootstrap.com/snippets/standard/grzegorz-bujanski/3796738#js-tab-view


Grzegorz Bujański staff answered 3 years ago

getInstance method is used to get an instance, not to pass an option. Here is an example of the default date setting: https://mdbootstrap.com/docs/standard/plugins/calendar/#section-default-date


Stylezst pro premium commented 3 years ago

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


Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Answered

Specification of the issue
  • User: Pro
  • 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