appsmithorg / appsmith

Platform to build admin panels, internal tools, and dashboards. Integrates with 25+ databases and any API.
https://www.appsmith.com
Apache License 2.0
34.52k stars 3.73k forks source link

[Bug]: DatePicker widget validation invalid within a Form when click the Today button and Max Date is today value #35969

Open phennapa-saeliw opened 2 months ago

phennapa-saeliw commented 2 months ago

Is there an existing issue for this?

Description

When I set the max date to the current date, the datepicker can normally select the current date when using the mouse. But if I click on the 'Today' button, the form becomes invalid even though it selects the current date, the Submit button is disabled.

Steps To Reproduce

  1. Add a Datepicker widget within a Form widget
  2. Set the Max Date = {{moment()}} and set Time Precision = 'None' 2567-08-29 at 13 51
  3. If I select the current date by clicking on a current date on the calendar, the form becomes valid and the Submit button is enabled. 2567-08-29 at 14 03
  4. If I click the 'Today' button, the form becomes invalid, and the Submit button is disabled. 2567-08-29 at 14 06

Public Sample App

https://app.appsmith.com/app/bug-of-datepicker/page1-66d013ced5aa71001288f430

Environment

Production

Severity

Medium (Frustrating UX)

Issue video log

No response

Version

Cloud - 1.38.0

rahulbarwal commented 2 months ago

Hey @phennapa-saeliw, Thank you for reporting this bug. This currently is behaving incorrectly because DatePicker has a time component as well, which is turning out to greater then be value of moment() (which is calculated when app loads)

To help you unblock, for now, you can use {{moment().endOf('day')}}, this will ensure anytime during the day, this datepicker will work. We will prioritize this and fix the behavior to ignore the time part.

phennapa-saeliw commented 2 months ago

Hello @rahulbarwal , Oh, thank you very much for your advice. I tried to fix it by using {{moment().endOf('day')}} and it works great. I can now click the 'Today' button and the 'Submit' button can be used properly.