An important ingredient in the caching to the max recipe is sharing caches between users. When cache keys are free of user-specific attributes, requests are far more likely to hit a warm cache and remain snappy.
This cache sharing constraint means we can’t render local times. If we did, the time would be cached correctly for the first viewer and incorrectly for everyone in a different time zone.
Basecamp solves this problem using JavaScript. We always render <time>
tags in UTC time and then convert them client-side to the browser’s local time. We’ve been doing it this way since Basecamp launched and it has served us well.
We don’t want to be the only ones enjoying this so I plucked all the relevant bits from Basecamp and packaged them up. Here you go.