palantir/blueprint

DateRangePicker with singleMonthOnly enabled sometimes shows wrong month after selecting shortcut

开放

#4,526 创建于 2021年2月15日

 (6 条评论) (0 个反应) (0 位负责人)TypeScript (2,167 个派生)batch import
P2Package: datetimeType: bughelp wanted

仓库指标

星标
 (20,263 个星标)
PR 合并指标
 (平均合并 43天 10小时) (30 天内合并 27 个 PR)

描述

Environment

  • Package version(s): v3.38
  • Operating System: Linux/Windows
  • Browser name and version: Google Chrome v88

Code Sandbox

https://codesandbox.io/s/blueprint-sandbox-forked-j4ooz?file=/src/index.tsx

Steps to reproduce

ezgif-3-4c479ecd4a65

  1. Select (Past month) shortcut
  2. Select any of the smaller ranges shortcut from shortcut menu (Past week, Yesterday, Today)
  3. The selected range will not appear in the single month shown

Actual behavior

Selected range is inconsistent after toggling from past month to current week/day ranges from shortcut menu in single-month mode only.

Expected behavior

The calendar should show the month where the currently selected range is, instead of the previous one.

Possible solution

Not sure about the solution. Switching from past 3 month to current week/day works fine. Showing ending month as default may not also not be a correct solution as for higher ranges(6month,1 year), it will show the current month.

贡献者指南