appsmith icon indicating copy to clipboard operation
appsmith copied to clipboard

[Bug]: Today shortcut in the date picker does not follow rules of max & min dates

Open muezz opened this issue 2 years ago • 0 comments

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: image 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: image image 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: image 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

Front logo Front conversations

muezz avatar Oct 18 '22 10:10 muezz