Hey all,
I have a rather confusing problem. I use the following code to get two dates from my CMS displaying as "16.11.2023 - 23.11.2023) for example (german notation).
new Date($ctx.fetchedData.data[0].Datum_Beginn).toLocaleDateString("de-DE") + " – " + new Date($ctx.fetchedData.data[0].Datum_Ende).toLocaleDateString("de-DE")
In the Editor it perfectly works, and I get my two dates as they should be. But as soon as I push the changes to github/netlify via “Publish” it just takes the fallback value in the final page.
But the confusing part: Later on the same page I use a very similar notation
new Date($ctx.fetchedData.data.Tag_der_offenen_Tuer).toLocaleDateString("de-DE")
and it just works in the editor as well on the final published page.
The only difference I could notice is that the first example uses the http-fetcher component and the last example uses the data queries/integration feature. Any thoughts about this?
The page is built with nextjs in netlify, if that helps. (ID is vnMgaQhRPZQgVFconhiafP)
I’ll be taking a look. Usually if it’s using the fallback value is because $ctx.fetchedData.data[0].Datum_Beginn
is throwing an TypeError (like trying to do undefined[0]
) or because the data is still fetching.
Thank you!
Can you also DM me the published project?
Thanks to the help of @icaro I could resolve the error. I had a component called Date
and that confused with new Date()
. I renamed it and now it works.