Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

feat: fallback to date-fns.parseISO when date cannot be parsed #1080

Merged
merged 2 commits into from
Feb 7, 2024

Conversation

oliverpool
Copy link
Contributor

@oliverpool oliverpool commented Feb 6, 2024

I am migrating a website from Decap/NetlifyCMS and I have an issue with existing dates not being parsed.

The dates are stored as 2024-02-25T18:30:00.000Z (ISO format) and date-fns tries to parse it with the format "yyyy-MM-dd'T'HH:mm:ssXXX" (which does not raise an exception, but returns an Invalid Date): https://date-fns.org/v3.3.1/docs/parse

If parsing failed, Invalid Date will be returned. Invalid Date is a Date, whose time value is NaN. Time value of Date: http://es5.github.io/#x15.9.1.1

I don't mind storing them with the static-cms default, however it would be nice if static-cms could try harder to parse the date (instead of showing an empty date, losing the data).

Copy link

netlify bot commented Feb 6, 2024

Deploy Preview for demo-staticjscms ready!

Name Link
🔨 Latest commit ba0d8a7
🔍 Latest deploy log https://app.netlify.com/sites/demo-staticjscms/deploys/65c1f78efa304600082bd0f8
😎 Deploy Preview https://deploy-preview-1080.demo.staticcms.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Feb 6, 2024

Deploy Preview for staticjscms ready!

Name Link
🔨 Latest commit ba0d8a7
🔍 Latest deploy log https://app.netlify.com/sites/staticjscms/deploys/65c1f78d33c0b80008971246
😎 Deploy Preview https://deploy-preview-1080.staticcms.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@KaneFreeman KaneFreeman merged commit 7bd9732 into StaticJsCMS:main Feb 7, 2024
17 checks passed
@oliverpool oliverpool deleted the patch-2 branch February 7, 2024 20:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants