Commit Redux

A software development blog in commit-sized retrospectives

Displaying Timezones Correctly

Wednesday May 07 2025 • 05:34 AM

To show the timezone I wrote this monstrosity of a line within the ERB template for posts:

@post.created_at.in_time_zone("Pacific Time (US & Canada)").strftime("%A %B %d %Y • %I:%M %p")

I’m not sure how to configure timezones globally the way I can set environment variables in Heroku after deployment or even in Rails config files, but this works so far.

Update: I was using single quotes and double quotes in the line above… oops