Code Monkey home page Code Monkey logo

Comments (5)

mattjennings avatar mattjennings commented on July 17, 2024 1

@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.

e5c2ebc

from sveltekit-blog-template.

mattjennings avatar mattjennings commented on July 17, 2024

@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.

a86c4a7

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 avatar dami-i commented on July 17, 2024

@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.

a86c4a7

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 avatar dami-i commented on July 17, 2024

@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.

e5c2ebc

Date in JS is indeed hard to learn and understand completely.
Thank you for this awesome template.

from sveltekit-blog-template.

yannickh2 avatar yannickh2 commented on July 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.