I’ve used <time> elements in my blog re-theme, but technically they are invalid because what’s inside them isn’t in a correct format. That would be ignored if my <time> elements could have a dt-published="" and/or datetime="" on them but those need to be in “machine readable” formats, so if someone is using a human-readable format on the existing {date} function, we’d need some additional function for this particular purpose, maybe something like {pubdate}?
Note: I am not entirely sure of the difference and/or interplay between dt-published and datetime. I was looking at microformats at the time.
Earlier, I added {unix-date} (which outputs the unix epoch timestamp for the post) and didn’t really tell anyone, but I’m going to use the same approach for this, which is a thing-date format for specific date outputs.
Since the Microformat is looking for an ISO 8601 formatted date value, I’ve just added {iso8601-date} which provides that exact output. You should be able to use it like this:
<time class="dt-published" datetime="{iso8601-date}">(literally anything you want here)</time>
I think this will meet the goal, but as always, let me know if it needs any tweaking!
Only thing I still have a question about is that as near as I can tell from browsing, if no time zone is specified it’s considered “floating” and basically that time in any timezone.
(And then my brain hurts because I remember trying to do something on another project elsewhere where I couldn’t get timezone code that understood that the offset varies with daylight savings.)
Ah, good catch — and easy fix! {iso8601-date} will now output a complete ISO 8601 timestamp, including the GMT offset based on your configured timezone — this will account for the nuances of DST and all that. You should be good to go now!
This appears to be my day to go back through old topics looking for stuff I missed the first time around. This is one of them.
As I recently added Microformats across my weblog, this was a remaining bit for dt-published that I had sort of left undone. I recalled there being a discussion about it and there was—here it is!
Assuming I am also needing to add {iso8601-date} outside of a piece of content or template, in a config item, such as for “Tag page format” and similar, I would need to use $iso8601_date, which does not appear to be available. An itty bitty request to have that available for post variables in config as well.
There appears to be four places, at this time, I would need that: