-
-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Date format does not behave as expected (off by one day) #58
Comments
Mmm, interesting. Maybe we have to add an option to define a default timezone, or something like that. |
date-fns/date-fns#489 (comment) Yeah, looks like this is a known issue. There are some workarounds in that thread, I linked to one above. |
Intead in the plugin, I've fixed when the date is detected: be274c7 It's not published yet, but could you test it and confirm if it works fine to you? |
Unfortunately it does not seem to have fixed the issue. It is still off by a day. Here is how I ran the latest changes, in case that is somehow the issue (I'm not too familiar with deno):
|
The way to run the latest changes is editing your _config.js file to import the last version of lume. You don't need to clone the repo, just import directly using the raw github url: import lume from "https://raw.githubusercontent.com/lumeland/lume/be274c7ecc7877a18dcc2a8158009168a9f99968/mod.js";
// Here the rest of your code You can continue using |
Got it. I did that just now and the issue looks fixed. Thanks again for your assistance! 😄 |
Great. You can undo this change in your _config.js and use the latest stable version after releasing this. |
The following seems to work: Deno.env.set("TZ", "Europe/Helsinki"); We could add an option to abstract that: const site = lume({
timeZone: "Europe/Helsinki",
}); There should also be a note in the docs to not use a time zone offset in date values. The following won’t work correctly after the commit be274c7: ---
date: 2021-04-04 03:02:01 +03:00
templateEngine: njk,md
---
{{ date }} On my machine (where the time zone is
But without That’s because the time zone offset defaults to UTC ( |
Thanks @valtlai You're absolutelly right, my commit was only a hack for this specific case, but it doesn't solve the problem. I didn't know about |
Looks like |
@kevinlang Finally I've reverted this change because it's not the best way to solve this problem. For now, you can add |
@CM-IV If it helps, I'm using environment variables in the Lume tests to avoid different results in my computer and in GitHub actions: https://github.com/lumeland/lume/blob/master/deno.json#L3 |
I have a template with the date specified as e.g.,
2021-04-08
.I would expect this formatting:
To return:
However, it returns:
If I format with the
ATOM
format, I can see that the issue seems to be related to stripping off the timezone, or something.(I'm in GMT-4)
The text was updated successfully, but these errors were encountered: