You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! Not sure I'm holding this wrong, but I've got a (deceivingly simple) date problem.
Request
I want the specified date and time from my Markdown frontmatter to show in the built site. Currently, all dates and times are formatted in UTC (or whatever TZ is on the machine building the site).
Use case
For the date field in my posts' frontmatter, I use my current local time with time zone offset. Like this:
When formatting that in the templates, I want that date and time to show. It works on my machine (classic!), but when building on CI for deploying, dates are showing in UTC.
Using the format string PPP — HH:mm:
January 18th, 2024 — 13:44
when I want:
January 18th, 2024 — 20:44
I just want whatever I input as the formatted output 😄
I've read about setting the TZ var when building with lume, but I can't do that, since the local time for each post might vary (I might post across timezones).
Also, I can't do my own hacky date parsing and formatting, since I don't have access to the raw frontmatter record on the Page data: I only have the already parsed date: Date.
Maybe this is out of scope for Lume, but I thought I'd ask. Thanks for a never ending great job ❤️
Let me know if you can solve it with this. If it works fine, maybe this could be a Lume plugin (Some people ask me about using different timezones in multilanguage sites).
Yes, that'd work too, with the added benefit of documentation in the frontmatter.
But if not, would it be improper to suggest that Lume provides the frontmatter as a part of the Page interface somewhere? As I touched upon in:
Also, I can't do my own hacky date parsing and formatting, since I don't have access to the raw frontmatter record on the Page data: I only have the already parsed date: Date.
As "raw" as possible, meaning, no string → Date parsing whatsoever. Just raw strings (and maybe number | boolean :)).
Enter your suggestions in details:
Hi! Not sure I'm holding this wrong, but I've got a (deceivingly simple) date problem.
Request
I want the specified date and time from my Markdown frontmatter to show in the built site. Currently, all dates and times are formatted in UTC (or whatever
TZ
is on the machine building the site).Use case
For the
date
field in my posts' frontmatter, I use my current local time with time zone offset. Like this:Note the included timezone offset.
When formatting that in the templates, I want that date and time to show. It works on my machine (classic!), but when building on CI for deploying, dates are showing in UTC.
Using the format string
PPP — HH:mm
:when I want:
I just want whatever I input as the formatted output 😄
I've read about setting the
TZ
var when building withlume
, but I can't do that, since the local time for each post might vary (I might post across timezones).Also, I can't do my own hacky date parsing and formatting, since I don't have access to the raw frontmatter record on the
Page
data: I only have the already parseddate: Date
.Maybe this is out of scope for Lume, but I thought I'd ask. Thanks for a never ending great job ❤️
Info
Related:
The text was updated successfully, but these errors were encountered: