DEV Community

loading...

Discussion on: Why Older People Struggle In Programming Jobs

Collapse
eelstork profile image
Tea

Could be a UTC date would that still count as a bug.
Date is actually a fuzzier concept than the speed of light.

Thread Thread
johncarroll profile image
John Carroll • Edited

I briefly entertained the possibility that dev.to was intentionally using UTC dates, before discounting it. Forcing everyone to use UTC (especially without any indication in the UI that that was happening) would just be poor design. I don't think DEV would do that.

In this case, I suspect it was a DST issue on the server. I created an issue in the dev GitHub repo.

Thread Thread
bytebodger profile image
Adam Nathaniel Davis Author

I see this issue often and I assume (but don't know - I haven't gone so far as to inspect the code) that this is caused by saving values in UTC - but forgetting to convert them to local time on the display end. There are many ways to handle internationalization, but the standard approach I've always seen is: Store everything in UTC (i.e., in the database). Then transform it on the display end according to the user's locale. But this approach (if that is indeed what they're doing) often leads to these kinda little bugs where someone wrote some code that just grabs the raw date value and doesn't bother to localize it.

Of course, maybe something entirely different is going on... ¯_(ツ)_/¯