The Squishy Lab

Site Update: Timezones

Posted on under Musings

Just pushed an update to the site! Not anything big, but I wanted to talk about it.

So, what's different?

As you know, the site has a lot of features that involve showing the time something was posted. Comments, posts, messages—all of these items will show the time they were submitted to the site. This wasn't a difficult feature to implement; all it took was attaching a timestamp to every entry in the database. Pretty standard.

And that would be all there was to it, if it weren't for these things called timezones.

Timezone Woes

When I was developing the site, I hosted it on my local machine (i.e. my MacBook), and only ever accessed it from either the same computer or my phone. This meant that I only ever visited the site from the same timezone it was running in, and so I never even thought to deal with differences in server and client timezones.

Everything seemed fine until I set up a server to deploy the site to.

Upon deploying the site, I soon realized that the server was running in UTC time, and that as such, all of the times on the website were being displayed in UTC. Everything I did on the site seemed to show that it was happening 7 hours in the future! This, for obvious reasons, was not ideal.

As a quick fix, I went into the server settings and set the server time to UTC-7:00, as that is where I (and most of my intended audience) currently live. It wasn't ideal, but I just put it in place and told myself that I'd work on a fix in the coming weeks.

That was back in July. What about now?

Fixing the issue

By the beginning of September, this had been bothering me enough that I decided to finally do something about it. So, I set out to put out a fix in the form of client-side time rendering.

Fixing the issue was actually pretty simple—all it took was writing a client-side function to render timestamps during the page load, and then just calling the insertStrftime() function in the page to render a <time> element. This only took about half an hour, and now that it's uploaded, the site should work in all timezones! And yes, the servers are back on UTC.


So the timezone issue is fixed. But it did get me thinking a little bit…

What's in an Audience?

For as long as I've been maintaining this site, I've been doing so from the perspective of myself, for lack of a better word. I do put it out for the world to see, and I do share it with the people I hold close to myself, but I've always worked on this site primarily for myself. I've designed it with my own aesthetics, I've marked timestamps from my own timezone, and I've written its content in my own native language of English.

But as time has gone on and I've grown and moved around, I find that more and more of the people I share this site with live in different contexts and timezones.

At the end of the day, this is my website first and foremost, and I want it to be a reflection of myself more than anything else. But I think that by shifting the timestamp display to accommodate people all over the world, I'm in a way making this site both a place to express myself both for myself and for those that I care about.


That's all. I thought I'd have more to muse about with respect to this, but I suppose it just boils down to fixing the timestamp issue so that it doesn't bother me anymore.

Besides this, I do have more things I want to muse about, though. I'll probably update with those when I have the time. And I've got a big project that's almost ready to publish, so look out for that, too.

0 Comments

Log in to comment on posts.

Nothing here yet. Be the first to comment!