Commit cb514e80 authored by Sean Arnold's avatar Sean Arnold

Fix some Time & Date usages

parent a0bf828d
......@@ -88,12 +88,12 @@ class Iteration < ApplicationRecord
# ensure dates are in the future
def future_date
if start_date_changed?
errors.add(:start_date, s_("Iteration|cannot be in the past")) if start_date < Date.today
errors.add(:start_date, s_("Iteration|cannot be in the past")) if start_date < Date.current
errors.add(:start_date, s_("Iteration|cannot be more than 500 years in the future")) if start_date > 500.years.from_now
end
if due_date_changed?
errors.add(:due_date, s_("Iteration|cannot be in the past")) if due_date < Date.today
errors.add(:due_date, s_("Iteration|cannot be in the past")) if due_date < Date.current
errors.add(:due_date, s_("Iteration|cannot be more than 500 years in the future")) if due_date > 500.years.from_now
end
end
......
......@@ -20,7 +20,7 @@ module Ci
def notify_on_total_usage
return unless namespace.shared_runners_minutes_used? && namespace.last_ci_minutes_notification_at.nil?
namespace.update_columns(last_ci_minutes_notification_at: Time.now)
namespace.update_columns(last_ci_minutes_notification_at: Time.current)
CiMinutesUsageMailer.notify(namespace.name, recipients).deliver_later
end
......
......@@ -20,7 +20,7 @@ describe Iterations::CreateService do
{
title: 'v2.1.9',
description: 'Patch release to fix security issue',
start_date: Time.now.to_s,
start_date: Time.current.to_s,
due_date: 1.day.from_now.to_s
}
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment