Time off by 8 hours in `$relative_date` in Recent Posts

I have time setup as such in weblog configuration:

;; Time stuff
;; ----------

; You can use a timezone value from the "TZ database name" column on this 
; web page: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones

Timezone: US/Pacific
Date format: F j, Y g:i A

which gives the correct time for the date used in the post itself. However, the $relative_date that I use in Recent Posts, which I just happen to have placed right below the published date for a post, is off by 8 hours.

I don’t have a good example right now, because at this point my most recent post (Apple Annie’s Weblog · Hello Drafts!) just shows as a day ago. But yesterday, moments after publishing it, it was listed as 8 hours ago in Recent Posts.

Possible bug, tagging as such.

That’s weird, because my use of $relative_date on actual posts has been correct.

1 Like

Can you share an example of the Date: metadata on a post where this is happening? Thanks!

For the linked post above:

Date: 2023-03-11 11:17

OK, hmm. Assuming that’s meant to be 11:17 AM, could you add the AM bit there, save, and then let me know if that changes anything?

That’s a 24-hour time, I thought. It’s get populated that way.

Also, I won’t know if that does anything now because the relative time won’t show increments of hours above a day.

From weblog config: Date: $date for a new post gives that a 24-hour time, just checked

LOL, well I just published a new post and now it is opposite! The time on the post is wrong, and the one in the Recent post list is correct:

Note: my local time (in the screenshot above you can see in the iPad menu bar at the top) is not 8:22pm, but the relative time there was ‘2 minutes ago’.

That was straight out of weblog, not using anything sent from Drafts (just FYI in case that was in question), with Date: $date producing Date: 2023-03-12 20:22 which is not my local time. If I edit that now, and make it my local time, then relative date is off by 8 hours. I see now that if I send from Drafts, I get the correct post metadata, but the incorrect relative time happens. If I don’t, and it comes from Date: $date in weblog, then the date on the post itself is wrong, but the relative time is right!

I’m so sorry, I apparently haven’t been replying directly to you. Please see my additional replies to myself.

Heh, no worries! So, I actually just fixed this. The issue was really silly… it turns out that on that Wikipedia page that I said to reference to find your timezone, the rows in pink that were “links” to other timezones weren’t actually working. US/Pacific is one of those, and that’s the timezone in use on your weblog. It’s a pointer to America/Los_Angeles, which incidentally is the timezone that Bix was using. And that explains why relative times were displaying ok Bix’s weblog but not yours.

I’ve just now fixed this by coding in all of the links to the different timezones, so now everything points to what it should point to, and things should “just work” — though you may need to re-publish your weblog for the change to take effect (to do this, just pull up your configuration and click Save — no need to make any changes; that will trigger a rebuild).

Sorry for the headache there, and thanks for helping me to stamp out yet another bug!

1 Like

Interesting, and why I thought it odd that Bix wasn’t complaining about times being off!

1 Like

Can confirm this fix did not in fact break mine, which I heard Adam worry about on the stream.

1 Like

lol, thank you for checking! :prami_happy:

dangit I keep not replying to the right post

Hah, I’ve been doing that too all over the place! Don’t sweat it, though — fortunately Discourse makes it easy to see all new activity and such, so I won’t miss anything. No worries!