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

Issue with Date/moment helper for date with days above the 29th returns invalid date. #430

Open
emmanuel-receeve opened this issue Sep 2, 2024 · 1 comment

Comments

@emmanuel-receeve
Copy link

There is an issue with the date function handler in the handlesbar-helpers. It fails for all dates with days above the 29th (for example, 2024-06-30, 2024-07-31) return "invalid date". tested this here https://codesandbox.io/p/sandbox/dank-butterfly-j7dhfz

@emmanuel-receeve emmanuel-receeve changed the title Issue with Date helper for date with days above the 29th returns invalid date. Issue with Date/moment helper for date with days above the 29th returns invalid date. Sep 2, 2024
@ahnennyi
Copy link

ahnennyi commented Sep 30, 2024

There seems to be a bug in date library (version: 0.3.3) that is used for date parsing.
For example, if you have handlebars template:

{{date dateVariable "DD.MM.YYYY, HH:mm:ss"}}

This will produce following results:

dateVariable Result
2024-07-29 29.07.2024, 00:00:00
2024-07-30 Invalid date
2024-07-31 01.08.2024, 00:00:00
2024-07-32 30.09.2024, 20:24:00

You can disable date library by setting the parameter datejs=false:

{{date dateVariable "DD.MM.YYYY, HH:mm:ss" datejs=false}}

This will produce following results:

dateVariable Result
2024-07-29 29.07.2024, 00:00:00
2024-07-30 30.07.2024, 00:00:00
2024-07-31 31.07.2024, 00:00:00
2024-07-32 Invalid date

Note that, in this case, new Date() will be used to parse the date string.

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

No branches or pull requests

2 participants