palantir/blueprint

DateRangeInput doesn't update displayed date when closeOnSelection=false (in control mode)

Open

#4,484 opened on Jan 16, 2021

View on GitHub
 (0 comments) (1 reaction) (0 assignees)TypeScript (20,263 stars) (2,167 forks)batch import
P2Package: datetimeType: bughelp wanted

Description

Environment

  • Package version(s): @blueprintjs/datetime 3.20.0
  • Operating System: MacOS Mojave Version 10.14.6
  • Browser name and version: Firefox 84.0.2

Code Sandbox

Link to a minimal repro

Steps to reproduce

  1. Set the DateRangeInput to controlled mode (specify value and onChange props)
  2. Set closeOnSelection to false
  3. Change one of the dates

Actual behavior

The date is updated while hovering on different dates, but once the user clicks on a date, the displayed date becomes the old one (not the one the user clicked on). Once the user closes the DateRangeInput, the displayed date is updated to the correct one

Expected behavior

The date displayed after clicking on a date is the one that was clicked

Possible solution

For now I'm setting closeOnSelection=true. Not ideal, but less confusing than the current behavior

Contributor guide