Avoid using Date.today, better to use Date.current that takes timezone into account
This commit is contained in:
@@ -41,11 +41,11 @@ module Search
|
|||||||
end
|
end
|
||||||
|
|
||||||
def search_finish_date
|
def search_finish_date
|
||||||
(params[:advanced_search][:date_max].to_date rescue Date.today) || Date.today
|
(params[:advanced_search][:date_max].to_date rescue Date.current) || Date.current
|
||||||
end
|
end
|
||||||
|
|
||||||
def search_date_range
|
def search_date_range
|
||||||
[100.years.ago, search_start_date].max.beginning_of_day..[search_finish_date, Date.today].min.end_of_day
|
[100.years.ago, search_start_date].max.beginning_of_day..[search_finish_date, Date.current].min.end_of_day
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_search_order
|
def set_search_order
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class DirectMessage < ActiveRecord::Base
|
|||||||
validates :receiver, presence: true
|
validates :receiver, presence: true
|
||||||
validate :max_per_day
|
validate :max_per_day
|
||||||
|
|
||||||
scope :today, lambda { where('DATE(created_at) = ?', Date.today) }
|
scope :today, lambda { where('DATE(created_at) = ?', Date.current) }
|
||||||
|
|
||||||
def max_per_day
|
def max_per_day
|
||||||
return if errors.any?
|
return if errors.any?
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<%= image_tag "header_print_proposals.jpg", class: "for-print-only" %>
|
<%= image_tag "header_print_proposals.jpg", class: "for-print-only" %>
|
||||||
|
|
||||||
<div class="filters">
|
<div class="filters">
|
||||||
<span class="for-print-only date-for-print"><%= l Date.today, format: :long %></span>
|
<span class="for-print-only date-for-print"><%= l Date.current, format: :long %></span>
|
||||||
|
|
||||||
<h2 class="inline-block">
|
<h2 class="inline-block">
|
||||||
<span class="not-print"><%= t("proposals.index.select_order_long") %></span>
|
<span class="not-print"><%= t("proposals.index.select_order_long") %></span>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
class MigrateSpendingProposalsToInvestments
|
class MigrateSpendingProposalsToInvestments
|
||||||
|
|
||||||
def import(sp)
|
def import(sp)
|
||||||
budget = Budget.last || Budget.create!(name: Date.today.year.to_s, currency_symbol: "€")
|
budget = Budget.last || Budget.create!(name: Date.current.year.to_s, currency_symbol: "€")
|
||||||
|
|
||||||
group = nil
|
group = nil
|
||||||
heading = nil
|
heading = nil
|
||||||
|
|||||||
Reference in New Issue
Block a user