diff --git a/app/models/milestone.rb b/app/models/milestone.rb index 26cfdc5ef30..d6f94cad1fb 100644 --- a/app/models/milestone.rb +++ b/app/models/milestone.rb @@ -149,7 +149,7 @@ class Milestone < ActiveRecord::Base def self.upcoming_ids(projects, groups) rel = unscoped .for_projects_and_groups(projects, groups) - .active.where('milestones.due_date > NOW()') + .active.where('milestones.due_date > CURRENT_DATE') if Gitlab::Database.postgresql? rel.order(:project_id, :group_id, :due_date).select('DISTINCT ON (project_id, group_id) id') @@ -161,7 +161,7 @@ class Milestone < ActiveRecord::Base ON milestones.project_id <=> earlier_milestones.project_id AND milestones.group_id <=> earlier_milestones.group_id AND milestones.due_date > earlier_milestones.due_date - AND earlier_milestones.due_date > NOW() + AND earlier_milestones.due_date > CURRENT_DATE AND earlier_milestones.state = 'active' HEREDOC diff --git a/changelogs/unreleased/use-date-for-upcoming-milestone-comparison.yml b/changelogs/unreleased/use-date-for-upcoming-milestone-comparison.yml new file mode 100644 index 00000000000..06c638a6522 --- /dev/null +++ b/changelogs/unreleased/use-date-for-upcoming-milestone-comparison.yml @@ -0,0 +1,5 @@ +--- +title: Fix upcoming milestone when there are milestones with far-future due dates +merge_request: +author: +type: fixed