Tell us what should happen.
In my project, filter is used to show the bookings between from and to dates, for that date picker is used to get the from and to date, while choosing the date in datepicker, it is in this format "dd/mm/yyyy" after filtering the records the format should be displayed in same format like this "dd/mm/yyyy"
Actual behaviour
Tell us what happens instead.
But the format displayed is "yyyy-mm-dd"
I also tried these, but nothing worked
value: @linguist_filter_form.with_bookings_to_date.to_fs
value: @linguist_filter_form.with_bookings_to_date.strftime('%d/%m/%Y')
value: @linguist_filter_form.with_bookings_from_date.nil? ? nil : @linguist_filter_form.with_bookings_from_date.strftime('%d/%m/%Y')
Jsfiddle example to reproduce the problem.
![Screenshot 2023-10-12 at 4 35 44 PM](https://github.com/uxsolutions/bootstrap-da
tepicker/assets/96114251/8bccd675-c908-4fd1-a3a6-d36c5dee2ca6)
Expected behaviour
Tell us what should happen. In my project, filter is used to show the bookings between from and to dates, for that date picker is used to get the from and to date, while choosing the date in datepicker, it is in this format "dd/mm/yyyy" after filtering the records the format should be displayed in same format like this "dd/mm/yyyy"
Actual behaviour
Tell us what happens instead. But the format displayed is "yyyy-mm-dd"
Datepicker version used
bootstrap-datepicker-rails (1.10.0.1)
Example code
in _filter_form.html.haml: = form_for @linguist_filter_form, url: "/account/linguists/filter", method: :post, html: { class: 'form-inline' } do |f| .form-group = f.label :with_bookings_from_date, "With bookings from", class: 'sr-only' .input-group.date#with_bookings_from_date{ data: { behaviour: 'linguist-datepicker' } } = f.text_field :with_bookings_from_date, value: @linguist_filter_form.with_bookings_from_date, placeholder: 'With bookings from', class: 'form-control', onkeydown: "event.preventDefault()" %span.input-group-addon %span.glyphicon.glyphicon-calendar
.form-group = f.label :with_bookings_to_date, "With bookings to", class: 'sr-only' .input-group.date#with_bookings_to_date{ data: { behaviour: 'linguist-datepicker' } } = f.text_field :with_bookings_to_date, value: @linguist_filter_form.with_bookings_to_date, placeholder: 'With bookings to', class: 'form-control', onkeydown: "event.preventDefault()" %span.input-group-addon %span.glyphicon.glyphicon-calendar
in linguists.js:
var linguist_datetime_picker = { initialize: function() { $("[data-behaviour~='linguist-datetimepicker']").datetimepicker({ useCurrent: false, locale: 'en-gb', keepInvalid: true, showClear: true, widgetPositioning: { horizontal: 'auto', vertical: 'bottom' } }); $("[data-behaviour~='linguist-datepicker']").datetimepicker({ dateFormat: 'dd/mm/yyyy', useCurrent: false, locale: 'en-gb', keepInvalid: true, showClear: true }); } };
I also tried these, but nothing worked value: @linguist_filter_form.with_bookings_to_date.to_fs value: @linguist_filter_form.with_bookings_to_date.strftime('%d/%m/%Y') value: @linguist_filter_form.with_bookings_from_date.nil? ? nil : @linguist_filter_form.with_bookings_from_date.strftime('%d/%m/%Y')
= f.text_field :with_bookings_to_date, value: @linguist_filter_form.with_bookings_to_date, placeholder: 'With bookings to', class: 'form-control', data: { date_format: 'DD/MM/YYYY'}
Jsfiddle example to reproduce the problem. ![Screenshot 2023-10-12 at 4 35 44 PM](https://github.com/uxsolutions/bootstrap-da tepicker/assets/96114251/8bccd675-c908-4fd1-a3a6-d36c5dee2ca6)