Site Tools


Hotfix release available: 2025-05-14b "Librarian". upgrade now! [56.2] (what's this?)
Hotfix release available: 2025-05-14a "Librarian". upgrade now! [56.1] (what's this?)
New release available: 2025-05-14 "Librarian". upgrade now! [56] (what's this?)
Hotfix release available: 2024-02-06b "Kaos". upgrade now! [55.2] (what's this?)
Hotfix release available: 2024-02-06a "Kaos". upgrade now! [55.1] (what's this?)
New release available: 2024-02-06 "Kaos". upgrade now! [55] (what's this?)
Hotfix release available: 2023-04-04b "Jack Jackrum". upgrade now! [54.2] (what's this?)
Hotfix release available: 2023-04-04a "Jack Jackrum". upgrade now! [54.1] (what's this?)
New release available: 2023-04-04 "Jack Jackrum". upgrade now! [54] (what's this?)
Hotfix release available: 2022-07-31b "Igor". upgrade now! [53.1] (what's this?)
Hotfix release available: 2022-07-31a "Igor". upgrade now! [53] (what's this?)
New release available: 2022-07-31 "Igor". upgrade now! [52.2] (what's this?)
New release candidate 2 available: rc2022-06-26 "Igor". upgrade now! [52.1] (what's this?)
New release candidate available: 2022-06-26 "Igor". upgrade now! [52] (what's this?)
Hotfix release available: 2020-07-29a "Hogfather". upgrade now! [51.4] (what's this?)
New release available: 2020-07-29 "Hogfather". upgrade now! [51.3] (what's this?)
New release candidate 3 available: 2020-06-09 "Hogfather". upgrade now! [51.2] (what's this?)
New release candidate 2 available: 2020-06-01 "Hogfather". upgrade now! [51.1] (what's this?)
New release candidate available: 2020-06-01 "Hogfather". upgrade now! [51] (what's this?)
Hotfix release available: 2018-04-22c "Greebo". upgrade now! [50.3] (what's this?)
Hotfix release available: 2018-04-22b "Greebo". upgrade now! [50.2] (what's this?)
time_zone_notes

Time Zone Notes

Currently, the application time zone is UTC. All the time related information should be displayed in

  • UTC for the users who are not logged in.
  • broswer's time zone at the time of login for logged in users.

This is achieved by using an around filter(TimeZoneFilter) in the base controller which wraps all the actions inside Time.use_zone(user_time_zone) block. So, the application time zone is changed to the parameter of Time.use_time_zone inside all the actions.

The logic to find the time zone from browser offset can be found in lib/time_helper.rb. Rails default TimeZone find does not search by summer and winter offsets, it searches by utc_offset and returns the first result that matches any one of the offsets. As more than one place can have same utc_offset, we would miss the daylight savings this way.(Ex- Bogota and Eastern Standard(EST) zones have same utc_offset. We always get Bogota which has no day light savings. But we might be in EST which uses DST). So, we are matching both summer and winter offsets.

Points to consider while dealing with time information -

1. Use Time.zone.* not Time.* - Most of the scenarios we need to deal with times in the current time zone not in the system time zone on which app is running. So, we should use Time.zone.now, Time.zone.parse and time_obj.in_time_zone(Time.zone) when we are dealing with time information.

2. Use Time.use_zone when we need to operate in other time zones than the current system. This sets back the system time zone when exception occurs. Otherwise we should always remember to set the system's time zone back to default.

3. When we add a new place from where some one can login, we should make sure that his time zone is getting updated. So, for now, after creating the user session we can call “set_user_time_zone(current_user)” in the controller. This method is defined in base_controller.rb

Server Timezone

  1. Servers to be configured at America/Los_Angeles timezone (All Learnexa)
  2. Servers to be configured at UTC (Expertus Meeting)
time_zone_notes.txt · Last modified: 2018/08/31 16:16 (external edit)