Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Enhance date validation logic and add tests for timePrecision i…
…n DatePickerWidget2 (#37218) ## Description <ins>Problem</ins> The DatePickerWidget2 component had incomplete date validation logic, allowing incorrect dates to be selected, and lacked comprehensive testing for time precision. <ins>Root cause</ins> The date validation logic did not accurately account for time precision, and the testing was limited, making it difficult to ensure the component's correctness. <ins>Solution</ins> This PR enhances the date validation logic in DatePickerWidget2 to provide better granularity checks based on the timePrecision property, and adds comprehensive tests to ensure correct date handling across boundaries for different timePrecision settings. This PR handles... - Enhanced date validation logic to accurately account for time precision. - Comprehensive testing to ensure correct date handling for all possible input combinations. Fixes #37083 _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.Datepicker" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11702221741> > Commit: 306373a > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11702221741&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.Datepicker` > Spec: > <hr>Wed, 06 Nov 2024 11:32:28 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced date validation logic in the DatePickerWidget2 for improved accuracy based on time precision. - **Tests** - Introduced comprehensive test cases for the `isValidDate` function, covering various scenarios related to time precision, ensuring robust validation against defined date ranges. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
- Loading branch information