Introduce altInput for flatpickr date(time)picker

- altInput is used to display the date to the end user: this field must be i18nized
 - dateFormat is the date format used through the front and the backend
This commit is contained in:
Jean-Baptiste Bellet
2021-02-19 11:16:43 +01:00
parent fe3fb78f76
commit c9cf989b27

View File

@@ -9,7 +9,9 @@ $(document).ready(function() {
fp.setDate(date, true);
}
window.FLATPICKR_DATE_DEFAULT = {
dateFormat: Spree.translations.flatpickr_date_format,
altInput: true,
altFormat: Spree.translations.flatpickr_date_format,
dateFormat: "Y-m-d",
locale: I18n.locale,
plugins: [
ShortcutButtonsPlugin({
@@ -25,7 +27,9 @@ $(document).ready(function() {
{},
window.FLATPICKR_DATE_DEFAULT,
{
dateFormat: Spree.translations.flatpickr_datetime_format,
altInput: true,
altFormat: Spree.translations.flatpickr_datetime_format,
dateFormat: "Y-m-d H:i",
enableTime: true,
time_24hr: true,
plugins: [