Force dateFormat to dd/mm/yyyy for all locales

To maintain consistency and the use of advanced search in the frontend,
we forced the expected date format for all languages. This is a temporary
solution that we should analyze in depth to allow different date formats
depending on the language in the filters.
This commit is contained in:
taitus
2020-01-28 17:19:15 +01:00
parent 3b2d4820cc
commit 14c38a2615
2 changed files with 12 additions and 0 deletions

View File

@@ -25,6 +25,7 @@
});
$(".js-calendar-full").datepicker();
$.datepicker.setDefaults($.datepicker.regional[locale]);
$.datepicker.setDefaults({ dateFormat: "dd/mm/yy" });
},
initialize: function() {
App.AdvancedSearch.init_calendar();

View File

@@ -179,6 +179,17 @@ describe "Admin banners magement" do
expect(page).not_to have_content "Wrong text"
end
scenario "when change date field on edit banner page display expected format", :js do
banner = create(:banner)
visit edit_admin_banner_path(banner)
fill_in "Post started at", with: "20/02/2002"
find_field("Post started at").click
within(".ui-datepicker") { click_link "22" }
expect(page).to have_field "Post started at", with: "22/02/2002"
end
scenario "Delete a banner" do
create(:banner, title: "Ugly banner",
description: "Bad text",