Fix first day of the week, formatting and calendar translation of the Date type field of the Elementor Pro Form widget.
In this topic we are going to see how to fix through JavaScript code, the problem of the calendar displayed in the date field of the Elementor Pro Form widget.
- The first problem arises because North American calendars continue to use Sunday as the first day of the week, while European calendars consider Monday as the first day.
- The second problem is that in this calendar the months and days of the week are in English.
- And the third problem is that when we select a date in the calendar it returns it in American date format Y-m-d (Year-month-day).
Elementor Pro uses the JavaScript Flatpickr library to implement a datepicker that facilitates the date section through a calendar, by default this library is in English, sets Sunday as the first day of the week and returns the date with amarican format.
What is a datepicker?
Datepikers are elements that help the user to select a date in a simple way through a visual calendar.
What is Flatpickr?
Flatpickr is a library dedicated to the creation of datepickers that does not depend on JQuery UI Datepicker, is lighter and is the one used by Elementor Pro to improve the selection of dates in the date fields of the Form widget.
Solution
Let’s see how to insert the code in our website.
- Click on the COPY CODE button above.
- In the WordPress admin panel navigate to Elementor > Custom Code.
- Click on the Add new button.
- Type a title and paste the code into the box below using CTRL+V (Windows) or CMD+V (Mac). You can also right-click and select Paste.
- Click on the Publish button.
- In the pop-up window set the display conditions, by default All site.
- Click on Save & Close.
Now the calendar in the Date field will be displayed correctly.