From c9cf989b27559d1c1f82b157e71e3b321e2dd77c Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bellet Date: Fri, 19 Feb 2021 11:16:43 +0100 Subject: [PATCH] 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 --- app/assets/javascripts/admin/util.js.erb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/admin/util.js.erb b/app/assets/javascripts/admin/util.js.erb index 698f199816..7bc849b5c1 100644 --- a/app/assets/javascripts/admin/util.js.erb +++ b/app/assets/javascripts/admin/util.js.erb @@ -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: [