Skip to content

Unable to type dates manually #296

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

Open
ujjaldey opened this issue Dec 24, 2024 · 10 comments · May be fixed by #310
Open

Unable to type dates manually #296

ujjaldey opened this issue Dec 24, 2024 · 10 comments · May be fixed by #310

Comments

@ujjaldey
Copy link

Hi,

I’m looking for guidance on enabling manual date entry in the date field. When I try to input a date manually (e.g., "2024-12-24"), it doesn’t behave as expected.

Below are examples for both single-date and date-range inputs where the issue occurs:

Single Date:

1.mov

Date Range:

2.mov

Could you please advise on how to resolve this? Your assistance would be greatly appreciated!

@bredelman
Copy link

This was definitely something introduced after 1.6.6 as updating this package broke some tests for us

@bredelman
Copy link

It looks like maybe (don't have time to fully investigate) it's something about how it was switched from using a dayjs instance to just using a datetime. v1.6.6...v1.7.0#diff-bce1fc1770cf6d695fd5eb08107e2b7e159444cd487d5969b5dbca84758a2e67R263

@ujjaldey
Copy link
Author

ujjaldey commented Jan 3, 2025

This was definitely something introduced after 1.6.6 as updating this package broke some tests for us

Thanks for the reply. I remember trying some older versions locally, but experienced the same issue.

@bathi-dev
Copy link

The issue is that dayjs() is too permissive and will try to create a date from partial inputs. We need to modify the dateStringToDate function to be more strict about what it considers a valid date string

export function dateStringToDate(dateString: string) {
    const parseDate = dayjs(dateString);

    if (!parseDate.isValid()) return null;

    return parseDate.toDate();
}

@bathi-dev bathi-dev linked a pull request Feb 21, 2025 that will close this issue
@ujjaldey
Copy link
Author

ujjaldey commented Mar 25, 2025

Hi, The PR does not seem to be merged yet. Can the admins please review and accept the change in the next build? Thanks.

@OrionPro
Copy link

Will there be any changes to address this problem?

@OrionPro
Copy link

OrionPro commented Apr 7, 2025

Have there been any updates on this issue?

@OrionPro
Copy link

The issue is that dayjs() is too permissive and will try to create a date from partial inputs. We need to modify the dateStringToDate function to be more strict about what it considers a valid date string

export function dateStringToDate(dateString: string) {
    const parseDate = dayjs(dateString);

    if (!parseDate.isValid()) return null;

    return parseDate.toDate();
}

I tried this change in my project, but the issue persists. Even with this modification, it's still not possible to manually input a date. The date keeps resetting to something unexpected, like 01/01/2001, even when I only enter "1". Even if I input a full date, the calendar still doesn't update accordingly. In conclusion, this comment won't resolve the bug with manually entering a date.

Image

@bathi-dev
Copy link

@OrionPro The code mentioned in the comment is the one causing the issue, and the fix for it is included in the PR that's pending merge.

#310

@OrionPro
Copy link

@bathi-dev I fully implemented the changes from that commit by creating my own fork and integrating it into my project. The fork included all the changes from the mentioned commit. I tested it thoroughly but didn’t see that it actually solves the problem.

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 a pull request may close this issue.

4 participants