Index: lib/redmine/helpers/calendar.rb =================================================================== --- lib/redmine/helpers/calendar.rb (revision 4175) +++ lib/redmine/helpers/calendar.rb (working copy) @@ -48,8 +48,8 @@ # Sets calendar events def events=(events) @events = events - @ending_events_by_days = @events.group_by {|event| event.due_date} - @starting_events_by_days = @events.group_by {|event| event.start_date} + @ending_events_by_days = @events.group_by {|event| event.due_date ? event.due_date.to_date() : nil} + @starting_events_by_days = @events.group_by {|event| event.start_date ? event.start_date.to_date() : nil} end # Returns events for the given day Index: lib/redmine/helpers/gantt.rb =================================================================== --- lib/redmine/helpers/gantt.rb (revision 4175) +++ lib/redmine/helpers/gantt.rb (working copy) @@ -292,14 +292,14 @@ case options[:format] when :html output = '' - i_left = ((project.start_date - self.date_from)*options[:zoom]).floor + i_left = ((project.start_date.to_date - self.date_from)*options[:zoom]).floor - start_date = project.start_date + start_date = project.start_date.to_date start_date ||= self.date_from start_left = ((start_date - self.date_from)*options[:zoom]).floor - i_end_date = ((project.due_date <= self.date_to) ? project.due_date : self.date_to ) - i_done_date = start_date + ((project.due_date - start_date+1)* project.completed_percent(:include_subprojects => true)/100).floor + i_end_date = ((project.due_date.to_date <= self.date_to) ? project.due_date.to_date : self.date_to ) + i_done_date = start_date + ((project.due_date.to_date - start_date+1)* project.completed_percent(:include_subprojects => true)/100).floor i_done_date = (i_done_date <= self.date_from ? self.date_from : i_done_date ) i_done_date = (i_done_date >= self.date_to ? self.date_to : i_done_date ) @@ -353,7 +353,7 @@ output when :image options[:image].stroke('transparent') - i_left = options[:subject_width] + ((project.due_date - self.date_from)*options[:zoom]).floor + i_left = options[:subject_width] + ((project.due_date.to_date - self.date_from)*options[:zoom]).floor # Make sure negative i_left doesn't overflow the subject if i_left > options[:subject_width] @@ -364,7 +364,7 @@ end when :pdf options[:pdf].SetY(options[:top]+1.5) - i_left = ((project.due_date - @date_from)*options[:zoom]) + i_left = ((project.due_date.to_date - @date_from)*options[:zoom]) # Make sure negative i_left doesn't overflow the subject if i_left > 0 @@ -426,14 +426,15 @@ case options[:format] when :html output = '' - i_left = ((version.start_date - self.date_from)*options[:zoom]).floor + i_left = ((version.start_date.to_date - self.date_from)*options[:zoom]).floor # TODO: or version.fixed_issues.collect(&:start_date).min start_date = version.fixed_issues.minimum('start_date') if version.fixed_issues.present? start_date ||= self.date_from + start_date = start_date.to_date start_left = ((start_date - self.date_from)*options[:zoom]).floor - i_end_date = ((version.due_date <= self.date_to) ? version.due_date : self.date_to ) - i_done_date = start_date + ((version.due_date - start_date+1)* version.completed_pourcent/100).floor + i_end_date = ((version.due_date.to_date <= self.date_to) ? version.due_date.to_date : self.date_to ) + i_done_date = start_date + ((version.due_date.to_date - start_date+1)* version.completed_pourcent/100).floor i_done_date = (i_done_date <= self.date_from ? self.date_from : i_done_date ) i_done_date = (i_done_date >= self.date_to ? self.date_to : i_done_date ) @@ -488,7 +489,7 @@ output when :image options[:image].stroke('transparent') - i_left = options[:subject_width] + ((version.start_date - @date_from)*options[:zoom]).floor + i_left = options[:subject_width] + ((version.start_date.to_date - @date_from)*options[:zoom]).floor # Make sure negative i_left doesn't overflow the subject if i_left > options[:subject_width] @@ -499,7 +500,7 @@ end when :pdf options[:pdf].SetY(options[:top]+1.5) - i_left = ((version.start_date - @date_from)*options[:zoom]) + i_left = ((version.start_date.to_date - @date_from)*options[:zoom]) # Make sure negative i_left doesn't overflow the subject if i_left > 0 @@ -580,13 +581,14 @@ output = '' # Handle nil start_dates, rare but can happen. i_start_date = if issue.start_date && issue.start_date >= self.date_from - issue.start_date + issue.start_date.to_date else self.date_from end - i_end_date = ((issue.due_before && issue.due_before <= self.date_to) ? issue.due_before : self.date_to ) - i_done_date = i_start_date + ((issue.due_before - i_start_date+1)*issue.done_ratio/100).floor + i_end_date = ((issue.due_before.to_date && issue.due_before.to_date <= self.date_to) ? issue.due_before.to_date : self.date_to ) + debugger + i_done_date = i_start_date + ((issue.due_before.to_date - i_start_date+1)*issue.done_ratio/100).floor i_done_date = (i_done_date <= self.date_from ? self.date_from : i_done_date ) i_done_date = (i_done_date >= self.date_to ? self.date_to : i_done_date ) @@ -635,8 +637,8 @@ @date_from end - i_end_date = (issue.due_before <= date_to ? issue.due_before : date_to ) - i_done_date = i_start_date + ((issue.due_before - i_start_date+1)*issue.done_ratio/100).floor + i_end_date = (issue.due_before.to_date <= date_to ? issue.due_before.to_date : date_to ) + i_done_date = i_start_date + ((issue.due_before.to_date - i_start_date+1)*issue.done_ratio/100).floor i_done_date = (i_done_date <= @date_from ? @date_from : i_done_date ) i_done_date = (i_done_date >= date_to ? date_to : i_done_date ) i_late_date = [i_end_date, Date.today].min if i_start_date < Date.today @@ -675,9 +677,9 @@ @date_from end - i_end_date = (issue.due_before <= @date_to ? issue.due_before : @date_to ) + i_end_date = (issue.due_before.to_date <= @date_to ? issue.due_before.to_date : @date_to ) - i_done_date = i_start_date + ((issue.due_before - i_start_date+1)*issue.done_ratio/100).floor + i_done_date = i_start_date + ((issue.due_before.to_date - i_start_date+1)*issue.done_ratio/100).floor i_done_date = (i_done_date <= @date_from ? @date_from : i_done_date ) i_done_date = (i_done_date >= @date_to ? @date_to : i_done_date )