This is a super easy way to ensure that timestamps/datetimes etc render correctly according to the timezone that the object is in.
In our usage we have a time_zone
attribute on our models that stores the time zone in a format that we can find with active support.
Example American Samoa
, for more examples run bundle exec rake time:zones:all
in your rails project.
We weren't aiming to display the datetime in a format relative to the user, but rather just display that the time was in X time zone
# lets assume we have an attribute called start_time