ruby - Weird Behaviors of datetime(timezone) in Rails application -
in our rails 3.2 application, have configured,
config.time_zone = 'london' config.active_record.default_timezone = :local
and in postgresql configured timezone "europe/london".
for past 1 week, our application datetime field not working timezone.
for example, if create reminder start_date @ 2015-08-18 10am
. creates `2015-08-18 10:00:00 in postgres database.
when displaying in template,
reminder start date: 2015-08-18 10am (2015-08-18 10:00:00 +0100 )
but,(not always) showing utc time.
reminder start date: 2015-08-18 9am (2015-08-18 09:00:00 utc )
it not reproduced in development.
if restart unicorn server not occurring 4 hours.
anyone faced kind of problem?
i fixed issue, adding around filter
in applicationcontroller
.
around_filter :use_time_zone private def use_time_zone(&block) time.use_zone('london', &block) end
so, whenever default timezone changed utc
, override , set bst
.
Comments
Post a Comment