From 6b82bd0a509b6b11a837ceae74de91d9b9637ad7 Mon Sep 17 00:00:00 2001 From: bohung Date: Fri, 26 Mar 2021 11:05:35 +0800 Subject: [PATCH] Fix bug in time zone. --- app/controllers/announcements_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/announcements_controller.rb b/app/controllers/announcements_controller.rb index 37fbf12..e9c55bc 100644 --- a/app/controllers/announcements_controller.rb +++ b/app/controllers/announcements_controller.rb @@ -183,6 +183,7 @@ class AnnouncementsController < ApplicationController anns = (top_anns + rest_anns).take(widget_data_count) end end + anns.each{|a| a["postdate"] = a["postdate"].in_time_zone(Time.zone.utc_offset / 3600).strftime('%Y-%m-%d %H:%M') rescue nil } mp = (anns[0]["img_src"] rescue "") mpd = (anns[0]["img_description"] rescue "") {