Comments (5)
@dami-i sorry for the delay - I gave this another look and added that timezone offsetting function. I've learned a bit more on how Dates work after this 😅 thanks a bunch for opening the issue with your solutions.
from sveltekit-blog-template.
@dami-i thanks for reporting this! I added parseISO
as you suggested. Instead of using that offset timezone function, I opted to format the metadata date as ISO with the date only (yyyy-MM-dd
) and I think that should work.
Would you be able to checkout the latest on this template and see if the build renders the dates properly?
from sveltekit-blog-template.
@dami-i thanks for reporting this! I added
parseISO
as you suggested. Instead of using that offset timezone function, I opted to format the metadata date as ISO with the date only (yyyy-MM-dd
) and I think that should work.Would you be able to checkout the latest on this template and see if the build renders the dates properly?
Thank you for paying attention to this issue.
It works better now, no buggy dates were displayed when testing. This one problem has been solved. ✔
However, timezone is still an issue. Not sure if this is a critical issue that's worth digging deep into a solution, though.
This is what happens in detail:
/posts/lorem-ipsum.md
---
title: Lorem Ipsum
date: 2022-01-02
---
Parsed ISO string: 2022-01-02T00:00:00.000Z
As I'm located in a region that's UTC -3 hours, the date rendered on the page is 2022-01-01T21:00:00.000Z
, which resolves to "January 1, 2022" (or "01/01/2022" on my locale date format).
If I type date: 2022-01-02 03:00:00
on the post header, it works just fine.
from sveltekit-blog-template.
@dami-i sorry for the delay - I gave this another look and added that timezone offsetting function. I've learned a bit more on how Dates work after this 😅 thanks a bunch for opening the issue with your solutions.
Date in JS is indeed hard to learn and understand completely.
Thank you for this awesome template.
from sveltekit-blog-template.
I might also have a similar problem:
Everything worked a few minutes ago. When I run dev I get this error and the app throws a 500 internal server error
` VITE v4.2.1 ready in 895 ms
➜ Local: http://localhost:5174/
➜ Network: use --host to expose
➜ press h to show help
4:28:17 PM [vite-plugin-svelte] ssr compile in progress ...
RangeError: Invalid time value
at Proxy.format (/home/test/Documents/test.com/node_modules/date-fns/format/index.js:372:11)
at PostDate.svelte:23:7
at Object.$$render (/node_modules/svelte/internal/index.mjs:1973:22)
at eval (/src/lib/components/PostsList.svelte:17:149)
at Module.each (/node_modules/svelte/internal/index.mjs:1939:16)
at eval (/src/lib/components/PostsList.svelte:16:134)
at Object.$$render (/node_modules/svelte/internal/index.mjs:1973:22)
at eval (/src/routes/+page.svelte:29:92)
at Object.$$render (/node_modules/svelte/internal/index.mjs:1973:22)
at Object.default (root.svelte:42:40)
4:28:19 PM [vite-plugin-svelte] ssr compile done.
package files time avg
sveltekit-blog-template 16 0.20s 12.7ms
RangeError: Invalid time value
at Proxy.format (/home/test/Documents/test.com/node_modules/date-fns/format/index.js:372:11)
at PostDate.svelte:23:7
at Object.$$render (/node_modules/svelte/internal/index.mjs:1973:22)
at eval (/src/lib/components/PostsList.svelte:17:149)
at Module.each (/node_modules/svelte/internal/index.mjs:1939:16)
at eval (/src/lib/components/PostsList.svelte:16:134)
at Object.$$render (/node_modules/svelte/internal/index.mjs:1973:22)
at eval (/src/routes/+page.svelte:29:92)
at Object.$$render (/node_modules/svelte/internal/index.mjs:1973:22)
at Object.default (root.svelte:42:40) `
I feel I only added some text to a blog post and suddenly this happened. Can I somehow give you more debug information?
from sveltekit-blog-template.
Related Issues (20)
- Cannot access query on a page with prerendering enabled HOT 2
- Unexpected token < in JSON at position 0 HOT 1
- Table of content HOT 1
- Update @sveltejs/kit HOT 7
- Switching post does not update the title, data and reading time HOT 1
- Better line breaks HOT 1
- Tags support HOT 2
- Rendering preview.html HOT 2
- Using variables in headings HOT 1
- Table of contents dont refresh after clicking internal link HOT 1
- Typescript rewrite HOT 2
- Using relative url (images) in YAML
- Build issue when deplyoing to Cloudflare pages HOT 1
- adding page transitions HOT 1
- An error occurred while processing non-English headings in the md document.
- need help debug website sveltekit
- Dynamically loading posts (infinite loading)
- Can you clarify how you want this code to be used by providing a license please ? HOT 2
- I am facing the same dynamic loader issue you had please help ! HOT 1
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 sveltekit-blog-template.