Magento – Changing Default magento 2.3 datepicker format

datepickermagento2

The default Magento date-picker format for birth-date on create account page is mm/dd/yyyy. how can i change it into dd/mm/yyyy format in Magento 2.3

Best Answer

Datepicker format is via customizations of the widget of the datepicker from jQuery UI. Check the DOB template and see how that's being triggered, if I am not wrong, they hardcode it via PHP block rendering. If I were you, I'll override the template and create a newer input field with the new call to the javascript widget so you can actually customize it.

Here: https://devdocs.magento.com/guides/v2.3/javascript-dev-guide/widgets/widget_calendar.html

For more information about the base of it: https://api.jqueryui.com/datepicker/

You have the parameters to set it. If you check here you will see the whole specs of the custom Magento widget: https://github.com/magento/magento2/blob/2.3/lib/web/mage/calendar.js

PS. I personally bring a third-party datepicker library because I don't like the basics from jQuery UI. This is my favorite: http://www.daterangepicker.com/

Related Topic