localize flatpickr date format

Flatpickr can format date. Use a localized dateFormat.
This commit is contained in:
Jean-Baptiste Bellet
2021-01-15 15:31:10 +01:00
parent 4d9289c45b
commit 4f7f8b559a
3 changed files with 5 additions and 1 deletions

View File

@@ -25,7 +25,7 @@ $(document).ready(function(){
}
);
window.FLATPICKR_DATE_DEFAULT = {
dateFormat: "Y-m-d H:i",
dateFormat: Spree.translations.flatpickr_date_format,
locale: I18n.locale
}
window.FLATPICKR_DATETIME_DEFAULT = Object.assign(

View File

@@ -3,6 +3,9 @@
{ :date_picker => Spree.t(:js_format,
:scope => 'date_picker',
:default => 'yy/mm/dd'),
:flatpickr_date_format => Spree.t(:flatpickr_date_format,
:scope => 'date_picker',
:default => 'Y-m-d H:i'),
:abbr_day_names => I18n.t(:abbr_day_names, :scope => :date),
:add => I18n.t(:add, scope: :actions),
:are_you_sure_delete => Spree.t(:are_you_sure_delete),

View File

@@ -3595,6 +3595,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using
date_picker:
format: ! '%Y-%m-%d'
js_format: 'yy-mm-dd'
flatpickr_date_format: "Y-m-d H:i"
orders:
error_flash_for_unavailable_items: "An item in your cart has become unavailable. Please update the selected quantities."
edit: