Revision | 3f6142e14be20c059148afa871400919af88647f (tree) |
---|---|
Time | 2017-08-11 07:07:41 |
Author | HMML <hmml3939@gmai...> |
Commiter | HMML |
Fix date calculate with timezone...
@@ -11,7 +11,7 @@ class Api::V1::ForecastsController < ApplicationController | ||
11 | 11 | @area = Area.find_by!(ns: params.require(:area_ns), code: params.require(:area_code)) |
12 | 12 | @area.timezone? and |
13 | 13 | Time.zone = @area.timezone |
14 | - start_date = (Time.now - 4.hours).to_date | |
14 | + start_date = Time.zone.now.to_date | |
15 | 15 | @forecasts = @area.forecasts.where('date >= ?', start_date).order(date: :asc) |
16 | 16 | end |
17 | 17 | end |
@@ -116,7 +116,7 @@ class FetchJmaContentJob < ApplicationJob | ||
116 | 116 | end |
117 | 117 | end |
118 | 118 | changed_area_ids.present? and |
119 | - Forecast.where("area_id IN (?) AND date < ?", changed_area_ids, Time.now.to_date).destroy_all | |
119 | + Forecast.where("area_id IN (?) AND date < ?", changed_area_ids, (Time.zone.now - 1.day).to_date).destroy_all | |
120 | 120 | end # Area.transaction |
121 | 121 | end |
122 | 122 |