Patch #1705

Use Rails timezones support

Added by Artem Vasiliev over 14 years ago. Updated over 11 years ago.

Status:NewStart date:2008-07-29
Priority:NormalDue date:
Assignee:-% Done:


Category:Rails support
Target version:-


This switches off previous time offset calculation when showing time values to user, relying on Rails timezones support instead.

This is essential for cases when time is entered by user, so we need this for our #1650 patch (otherwise user sees his time +his timezone offset).

This doesn't bring much to current Redmine as all the time fields are populated automatically currently. May be it could be used to correct SCM timestamps if some give it in non-UTC. And surely this will help time values in custom fields when they support it.

After this patch is applied all the datetimes in the database will be interpreted as being in UTC, so if they don't they need to be updated. For this new redmine:convert_database_times_to_utc rake task is included. Be sure to correct its LOCAL_UTC_OFFSET and back up the database prior to running.

Contributed by Texuna Technologies.

rails_timezones.patch Magnifier (3.85 KB) Artem Vasiliev, 2008-07-29 15:09

rails_timezones.patch Magnifier - typo fixed in rake task (3.85 KB) Artem Vasiliev, 2008-07-29 15:32

Related issues

Related to Redmine - Defect #3734: fetch_changesets save local time instead of GMT in the da... Needs feedback 2009-08-13
Related to Redmine - Feature #2531: "Within period" query filters for date fields Closed 2009-01-19
Related to Redmine - Defect #5560: Changing System Time Zone Causes Issue Updates to Change ... New 2010-05-19


#1 Updated by Artem Vasiliev over 14 years ago has good introduction to (and discussion of) Rails 2.1 timezones support.

#2 Updated by Artem Vasiliev over 14 years ago

Also config/environment.rb need to be adjusted for particular server (config.time_zone setting)

#4 Updated by Artem Vasiliev almost 14 years ago

This is used in #2531's implementation

#5 Updated by Toshi MARUYAMA over 11 years ago

  • Category set to Rails support

Also available in: Atom PDF