Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: How do I set start and end date-limits to Datetimepicker

maheshbasapur free asked 3 years ago


Expected behavior I should be able to set upper / lower / both-upper-and-lower limit to Datetimepicker

When set, I should not be able to select dates below lower limit and above upper limit

Actual behavior Have no idea how to do it. Documentation seem to be non-existentant

Resources (screenshots, code snippets etc.)


Michał Duszak staff answered 3 years ago


You are able. Datetimepicker documentation says that Datepicker and Timepicker options works only with JS initialization. https://mdbootstrap.com/docs/standard/forms/datetimepicker/#section-dateTime-options

Options for each Datepicker and Timepicker are listed on according documentation pages:

https://mdbootstrap.com/docs/standard/forms/datepicker/ https://mdbootstrap.com/docs/standard/forms/timepicker/

Example on how to set ranges on hour and dates:

const pickerDateOptions = document.querySelector('#datetimepicker-dateOptions');
new mdb.Datetimepicker(pickerDateOptions, {
    datepicker: { min: new Date(2021, 8, 10), max: new Date(2021, 8, 20)},
    timepicker: { minHour: 6, maxHour: 12},
});

https://mdbootstrap.com/snippets/standard/m-duszak/3311829#js-tab-view



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

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: MDB5 3.9.0
  • Device: mackbook
  • Browser: safari
  • OS: Mac
  • Provided sample code: No
  • Provided link: No
Tags