Topic: Today Button in Datepicker

AnotherStep free asked 3 years ago


Hello, in your datepicker the default buttons that appear are "Clear", "Close" and "Ok". I would like to know which settings to put in the initialization of the datepicker to also insert the "today" button.

Thanks so much.


Krzysztof Wilk staff answered 3 years ago


Hi!

You can define it when you are initializing an instance of the date picker. Your code should look like this:

// Data Picker Initialization
$('.datepicker').datepicker({
     inline: true;

    // Buttons
    today: 'Today',
    clear: 'Clear',
    close: 'Close',
});

For more available options you can go here: https://mdbootstrap.com/docs/jquery/forms/date-picker/

Best regards


soiware priority commented 1 year ago

I tryed with new mdb.Datepicker(myDateEle, { inline: false, today: "Today" });

But the "Today" button doesn't appear. Can you please publish a snipped? Thank you.


Mateusz Lazaru staff commented 1 year ago

This option was available in old version of the MDB4 datepicker, not supported anymore. Here is a link for anyone looking for its documentation: https://mdbootstrap.com/docs/b4/jquery/forms/date-picker1/


soiware priority commented 1 year ago

Is there a way to have it again? Some users of mine complains abount having lost it.


Mateusz Lazaru staff commented 1 year ago

At the moment, we are not planning to add this button. In the old datepicker, the 'clear' button reset the selected day and closed the modal. Now, this button doesn't close the modal anymore, but it navigates back to 'today' and focuses on this day. I think adding a new button would have a negative impact on the design of the component, and it's not really worth that.

If you disagree with me and find this feature useful, I would encourage you to open a feature-request. This might let us know what other users think and also open discussion in our team.

https://mdbootstrap.com/support/new-feature-request/



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 jQuery
  • MDB Version: 4.19.1
  • Device: Pc
  • Browser: Chrome
  • OS: Windows
  • Provided sample code: No
  • Provided link: No