Index: app/helpers/application_helper.rb =================================================================== --- app/helpers/application_helper.rb (revision 15361) +++ app/helpers/application_helper.rb (working copy) @@ -1171,7 +1171,7 @@ def calendar_for(field_id) include_calendar_headers_tags - javascript_tag("$(function() { $('##{field_id}').addClass('date').datepicker(datepickerOptions); });") + javascript_tag("$(function() { $('##{field_id}').addClass('date').datepickerFallback(datepickerOptions); });") end def include_calendar_headers_tags Index: app/views/custom_fields/formats/_date.html.erb =================================================================== --- app/views/custom_fields/formats/_date.html.erb (revision 15361) +++ app/views/custom_fields/formats/_date.html.erb (working copy) @@ -1,3 +1,3 @@ -

<%= f.text_field(:default_value, :size => 10) %>

+

<%= f.date_field(:default_value, :value => @custom_field.default_value, :size => 10) %>

<%= calendar_for('custom_field_default_value') %>

<%= f.text_field :url_pattern, :size => 50, :label => :label_link_values_to %>

Index: app/views/issues/_attributes.html.erb =================================================================== --- app/views/issues/_attributes.html.erb (revision 15361) +++ app/views/issues/_attributes.html.erb (working copy) @@ -52,14 +52,14 @@ <% if @issue.safe_attribute? 'start_date' %>

- <%= f.text_field(:start_date, :size => 10, :required => @issue.required_attribute?('start_date')) %> + <%= f.date_field(:start_date, :size => 10, :required => @issue.required_attribute?('start_date')) %> <%= calendar_for('issue_start_date') %>

<% end %> <% if @issue.safe_attribute? 'due_date' %>

- <%= f.text_field(:due_date, :size => 10, :required => @issue.required_attribute?('due_date')) %> + <%= f.date_field(:due_date, :size => 10, :required => @issue.required_attribute?('due_date')) %> <%= calendar_for('issue_due_date') %>

<% end %> Index: app/views/issues/bulk_edit.html.erb =================================================================== --- app/views/issues/bulk_edit.html.erb (revision 15361) +++ app/views/issues/bulk_edit.html.erb (working copy) @@ -147,7 +147,7 @@ <% if @safe_attributes.include?('start_date') %>

- <%= text_field_tag 'issue[start_date]', '', :value => @issue_params[:start_date], :size => 10 %><%= calendar_for('issue_start_date') %> + <%= date_field_tag 'issue[start_date]', '', :value => @issue_params[:start_date], :size => 10 %><%= calendar_for('issue_start_date') %>

<% end %> @@ -155,7 +155,7 @@ <% if @safe_attributes.include?('due_date') %>

- <%= text_field_tag 'issue[due_date]', '', :value => @issue_params[:due_date], :size => 10 %><%= calendar_for('issue_due_date') %> + <%= date_field_tag 'issue[due_date]', '', :value => @issue_params[:due_date], :size => 10 %><%= calendar_for('issue_due_date') %>

<% end %> Index: app/views/timelog/_form.html.erb =================================================================== --- app/views/timelog/_form.html.erb (revision 15361) +++ app/views/timelog/_form.html.erb (working copy) @@ -17,7 +17,7 @@ <%= "#{@time_entry.issue.tracker.name} ##{@time_entry.issue.id}: #{@time_entry.issue.subject}" %> <% end %>

-

<%= f.text_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %>

+

<%= f.date_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %>

<%= f.text_field :hours, :size => 6, :required => true %>

<%= f.text_field :comments, :size => 100, :maxlength => 1024 %>

<%= f.select :activity_id, activity_collection_for_select_options(@time_entry), :required => true %>

Index: app/views/timelog/bulk_edit.html.erb =================================================================== --- app/views/timelog/bulk_edit.html.erb (revision 15361) +++ app/views/timelog/bulk_edit.html.erb (working copy) @@ -18,7 +18,7 @@

- <%= text_field :time_entry, :spent_on, :size => 10 %><%= calendar_for('time_entry_spent_on') %> + <%= date_field :time_entry, :spent_on, :size => 10 %><%= calendar_for('time_entry_spent_on') %>

Index: app/views/versions/_form.html.erb =================================================================== --- app/views/versions/_form.html.erb (revision 15361) +++ app/views/versions/_form.html.erb (working copy) @@ -6,7 +6,7 @@

<%= f.text_field :description, :size => 60 %>

<%= f.select :status, Version::VERSION_STATUSES.collect {|s| [l("version_status_#{s}"), s]} %>

<%= f.text_field :wiki_page_title, :label => :label_wiki_page, :size => 60, :disabled => @project.wiki.nil? %>

-

<%= f.text_field :effective_date, :size => 10 %><%= calendar_for('version_effective_date') %>

+

<%= f.date_field :effective_date, :size => 10 %><%= calendar_for('version_effective_date') %>

<%= f.select :sharing, @version.allowed_sharings.collect {|v| [format_version_sharing(v), v]} %>

<% @version.custom_field_values.each do |value| %> Index: lib/redmine/field_format.rb =================================================================== --- lib/redmine/field_format.rb (revision 15361) +++ lib/redmine/field_format.rb (working copy) @@ -461,12 +461,12 @@ end def edit_tag(view, tag_id, tag_name, custom_value, options={}) - view.text_field_tag(tag_name, custom_value.value, options.merge(:id => tag_id, :size => 10)) + + view.date_field_tag(tag_name, custom_value.value, options.merge(:id => tag_id, :size => 10)) + view.calendar_for(tag_id) end def bulk_edit_tag(view, tag_id, tag_name, custom_field, objects, value, options={}) - view.text_field_tag(tag_name, value, options.merge(:id => tag_id, :size => 10)) + + view.date_field_tag(tag_name, value, options.merge(:id => tag_id, :size => 10)) + view.calendar_for(tag_id) + bulk_clear_tag(view, tag_id, tag_name, custom_field, value) end Index: public/javascripts/application.js =================================================================== --- public/javascripts/application.js (revision 15361) +++ public/javascripts/application.js (working copy) @@ -185,12 +185,12 @@ case "date": case "date_past": tr.find('td.values').append( - '' + - ' ' + + '' + + ' ' + ' '+labelDayPlural+'' ); - $('#values_'+fieldId+'_1').val(values[0]).datepicker(datepickerOptions); - $('#values_'+fieldId+'_2').val(values[1]).datepicker(datepickerOptions); + $('#values_'+fieldId+'_1').val(values[0]).datepickerFallback(datepickerOptions); + $('#values_'+fieldId+'_2').val(values[1]).datepickerFallback(datepickerOptions); $('#values_'+fieldId).val(values[0]); break; case "string": @@ -587,7 +587,7 @@ } break; } - $(input).datepicker("option", "defaultDate", default_date); + $(input).datepickerFallback("option", "defaultDate", default_date); } (function($){ @@ -723,6 +723,33 @@ function toggleDisabledInit() { $('input[data-disables], input[data-enables]').each(toggleDisabledOnChange); } + +(function ( $ ) { + + // detect if native date input is supported + var nativeDateInputSupported = true; + + var input = document.createElement('input'); + input.setAttribute('type','date'); + if (input.type === 'text') { + nativeDateInputSupported = false; + } + + var notADateValue = 'not-a-date'; + input.setAttribute('value', notADateValue); + if (input.value === notADateValue) { + nativeDateInputSupported = false; + } + + $.fn.datepickerFallback = function( options ) { + if (nativeDateInputSupported) { + return this; + } else { + return this.datepicker( options ); + } + }; +}( jQuery )); + $(document).ready(function(){ $('#content').on('change', 'input[data-disables], input[data-enables]', toggleDisabledOnChange); toggleDisabledInit();