Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing with Unix Timestamp tokens X/x and strict mode results in Invalid Date #1533

Closed
safareli opened this issue Jun 16, 2021 · 2 comments · Fixed by #1567
Closed

Parsing with Unix Timestamp tokens X/x and strict mode results in Invalid Date #1533

safareli opened this issue Jun 16, 2021 · 2 comments · Fixed by #1567
Labels

Comments

@safareli
Copy link

safareli commented Jun 16, 2021

Describe the bug

When x and X from dayjs/plugin/advancedFormat is used with strict mode parse fails:

dayjs(`/Date(${dayjs().format('x')})/`,"/[Date](x)/").format('/[Date](x)/')
> "/Date(1623787200000)/"
dayjs(`/Date(${dayjs().format('X')})/`,"/[Date](X)/").format('/[Date](X)/')
> "/Date(1623787200)/"

dayjs(`/Date(${dayjs().format('x')})/`,"/[Date](x)/",true).format('/[Date](x)/')
> "Invalid Date"
dayjs(`/Date(${dayjs().format('X')})/`,"/[Date](X)/",true).format('/[Date](X)/')
> "Invalid Date"

Expected behavior
last 2 examples should parse correctly as fist 2 cases do.

Information
tested on recent version of chrome (in dev tools of https://day.js.org/)

looks like related to:
#1467
#929
#1467

@iamkun
Copy link
Owner

iamkun commented Jul 6, 2021

🎉 This issue has been resolved in version 1.10.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

@safareli
Copy link
Author

safareli commented Jul 6, 2021

Thanks for working on this @iamkun tho there is still has a bug. This example provided in this issue still returns Invalid Date. X/x tokens only work properly when they are used only without any other visual/escaped token in format.

I've open more specific issue for this #1569

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants