Comments (13)
Great. You can undo this change in your _config.js and use the latest stable version after releasing this.
from lume.
Mmm, interesting. Maybe we have to add an option to define a default timezone, or something like that.
from lume.
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.
from lume.
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?
from lume.
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):
- Cloned this repo to an adjacent folder
- Ensured that the commit above was present in the clone
- From the adjacent folder that had my site, I ran
deno run --unstable -A ../lume/cli.js --serv
from lume.
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 lume --serve
(or lume -s
) command because the cli has not changed.
from lume.
Got it. I did that just now and the issue looks fixed. Thanks again for your assistance! ๐
from lume.
Mmm, interesting. Maybe we have to add an option to define a default timezone, or something like that.
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 Europe/Helsinki
and offset UTC+03:00 in DST), it outputs:
Sun Apr 04 2021 00:02:01 GMT+0300 (Eastern European Summer Time)
But without +03:00
in the date
field, it works correctly. Before the commit, it behaved on the contrary: correctly with a time zone offset and incorrectly without it.
Thatโs because the time zone offset defaults to UTC (Z
= +00:00
).
from lume.
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 TZ
environment variable, and it looks a better solution because it will be applied to all Date
instances created, not only to the date
value.
from lume.
Looks like Deno.env.set("TZ", "Z");
does the job.
from lume.
@kevinlang Finally I've reverted this change because it's not the best way to solve this problem.
For now, you can add Deno.env.set("TZ", "Z")
to your _config.js
file.
from lume.
This is an old issue, but I'm basically having the same problem. The date is behind by 1 day for me even after I set the TZ inside of the _config.ts
file (America/Chicago).
In order to offset this somewhat, I change my TZ to Australia/Canberra and I then get the correct date.
from lume.
@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 think it's safer to provide the environment in the cli command.
from lume.
Related Issues (20)
- Copying an underscored file removes the underscore HOT 3
- Merge site.copy and site.loadAssets? HOT 1
- `--unstable` deprecation warning HOT 3
- Inline plugin: inline external images HOT 6
- Support for removal of trailing slash in URL HOT 2
- Plugin Nav: Cannot access 'item' before initialization HOT 3
- Minify <style> CSS from UnoCSS, when using `cssFile: false` HOT 2
- Use local version of Decap CMS script instead of unpkg.com HOT 2
- Search plugin seems to be missing pages generated by the multilanguage plugin HOT 6
- .well-known support HOT 3
- Filter Pages plugin removes asset files (arguably unexpected -- documentation issue?) HOT 2
- page does not refresh when _components/XXX.tsx is modified HOT 5
- esbuild plugin: timeout after 10 second on `deno task build` HOT 6
- Question: how to support both rendering .html from a file and also copying the raw file HOT 1
- esbuild: `.ts` imports aren't transformed into `.js` HOT 4
- `deno task lume` fails directly after init HOT 2
- Add image support in feeds. HOT 1
- Can't loop through search.pages() using Liquid HOT 2
- Add support for author in the feed plugin
- Lume failse to build/serve with atypical Linux directory structure. HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lume.