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

Use DATE_FORMAT when parsing selected date #61

Merged
merged 1 commit into from
Feb 12, 2024
Merged

Use DATE_FORMAT when parsing selected date #61

merged 1 commit into from
Feb 12, 2024

Conversation

ghost
Copy link

@ghost ghost commented Feb 9, 2024

Potential fix for #60, at least in 'single' mode.

I implemented the datepicker a few days ago in one of our projects and everything worked fine until yesterday. Not sure if a third-party library, such as Dayjs, was changed recently and if that caused this functionality to break, but I was able to narrow down the problem:

At least in the 'single' view mode, the date is sent back in the format "YYYY-MM-DD" (DATE_FORMAT) and not "YYYY-MM-DD HH:mm" (CALENDAR_FORMAT), but the CALENDAR_FORMAT is assumed while parsing.

Since I don't know the code base that well, this definitely should be tested with modes other than 'single', since that is the only mode we're using in our project. Additionally, it might be possible to get the date in the CALENDAR_FORMAT even when you're only picking a 'single' date. That would also prevent the problem and might be a more generic/better solution.

At least in the 'single' view mode, the date is sent back in the format "YYYY-MM-DD" and not "YYYY-MM-DD HH:mm" and dayjs fails here while parsing the date.
@farhoudshapouran farhoudshapouran merged commit 537a0bb into farhoudshapouran:main Feb 12, 2024
3 checks passed
@farhoudshapouran
Copy link
Owner

@CH-Ama Thank you for your fixes, I merged it with the main branch

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

Successfully merging this pull request may close these issues.

2 participants