Commit 238297f9891314d8feb2308f64907135082a34bb
1 parent
d877a56d
Exists in
staging
and in
7 other branches
Fix to the issue https://gitlab.com/noosfero/noosfero/issues/153 (Event form not…
… loading on datepickers)" In discussion-app there is a issue to this too https://softwarepublico.gov.br/gitlab/noosfero-apps/discussion-app/issues/21
Showing
1 changed file
with
2 additions
and
1 deletions
Show diff stats
app/helpers/forms_helper.rb
@@ -184,6 +184,7 @@ module FormsHelper | @@ -184,6 +184,7 @@ module FormsHelper | ||
184 | datepicker_options[:year_suffix] ||= '' | 184 | datepicker_options[:year_suffix] ||= '' |
185 | 185 | ||
186 | element_id = html_options[:id] || 'datepicker-date' | 186 | element_id = html_options[:id] || 'datepicker-date' |
187 | + value_js_formatted = value.strftime('%Y-%m-%d %H:%S') | ||
187 | value = value.strftime(format) if value.present? | 188 | value = value.strftime(format) if value.present? |
188 | method = datepicker_options[:time] ? 'datetimepicker' : 'datepicker' | 189 | method = datepicker_options[:time] ? 'datetimepicker' : 'datepicker' |
189 | result = text_field_tag(name, value, html_options) | 190 | result = text_field_tag(name, value, html_options) |
@@ -236,7 +237,7 @@ module FormsHelper | @@ -236,7 +237,7 @@ module FormsHelper | ||
236 | weekHeader: #{datepicker_options[:week_header].to_json}, | 237 | weekHeader: #{datepicker_options[:week_header].to_json}, |
237 | yearRange: #{datepicker_options[:year_range].to_json}, | 238 | yearRange: #{datepicker_options[:year_range].to_json}, |
238 | yearSuffix: #{datepicker_options[:year_suffix].to_json} | 239 | yearSuffix: #{datepicker_options[:year_suffix].to_json} |
239 | - }).datepicker('setDate', new Date('#{value}')) | 240 | + }).datepicker('setDate', new Date('#{value_js_formatted}')) |
240 | </script> | 241 | </script> |
241 | ".html_safe | 242 | ".html_safe |
242 | result | 243 | result |