appsmith
appsmith copied to clipboard
[Bug]: Today shortcut in the date picker does not follow rules of max & min dates
Is there an existing issue for this?
- [X] I have searched the existing issues
Description
I have two date picker widgets where one is for picking the start date and the other is for picking the end date. The pickers look like this:
I have the following rules for both pickers:
- Both start and end dates cannot be older than 90 days and it cannot be more than today.
- Start date cannot be beyond end date in case end date is chosen first
- End date cannot be before start date in case start date is chose first.
These rules are implemented in JS like this:
Given these rules, if a user chooses a date before today as the endDate and then clicks on the
Today
shortcut inside the startDate widget, both fields give an error like this:This is a fairly common use-case and I think, to prevent such situations, the following two approaches can be taken to fix this:
-
Automatically hide or unhide the
Today
shortcut if it does not follow the min and/or max dates of the widget. - Create a new parameter in the widget properties where the user can write their own JS logic to hide or unhide the shortcut.
Steps To Reproduce
My description gives the complete use-case with the relevant pieces of code which can be used to recreate this.
Public Sample App
No response
Version
Appsmith v1.8.5-SNAPSHOT