Skip to content
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

[date-picker] today button does not work if max is today #7505

Closed
ffray opened this issue Jun 29, 2024 · 1 comment · Fixed by #7516
Closed

[date-picker] today button does not work if max is today #7505

ffray opened this issue Jun 29, 2024 · 1 comment · Fixed by #7516

Comments

@ffray
Copy link

ffray commented Jun 29, 2024

Description

When adding a date-picker and setting the max to the current date, clicking today does not update the value.

However, when opening the Development Tools in e.g. in Chrome, Firefox or Safari, the value gets updated.

When the date-picker needs to scroll to display the current date, things seem to work again.

I have reproduced this also using the live demo (https://vaadin.com/docs/latest/components/date-picker) by specifying the max property there.

Expected outcome

I would expect Today is always updating the value as long as min <= date <= max.

Minimal reproducible example

<vaadin-date-picker label="Start date" max="2024-06-09"></vaadin-date-picker>

Steps to reproduce

Does not work:

  • Add date-picker
  • Set max to current date
  • Open overlay
  • Select current date
  • Close overlay
  • Open overlay
  • Click Today

Does work:

  • Add date-picker
  • Set max to current date
  • Open overlay
  • Select date in last month
  • Close overlay
  • Open overlay
  • Click Today

Environment

Vaadin version(s): 24.3, 24.4
OS: Mac OS 14.5

Browsers

Chrome, Firefox, Safari

@ffray ffray changed the title today button does not work if max is today [date-picker] today button does not work if max is today Jun 29, 2024
@web-padawan
Copy link
Member

Confirmed the issue. It's caused by the fact that we don't reset time in 00:00 when pressing "Today" button (unlike it's done in _isTodayAllowed() which works correctly). This should be easy to fix by reusing corresponding logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants