palantir / blueprint

A React-based UI toolkit for the web
https://blueprintjs.com/
Apache License 2.0
20.74k stars 2.18k forks source link

One and two digits years are handled incorrectly #4575

Open VyacheslavAS opened 3 years ago

VyacheslavAS commented 3 years ago

Environment

Code Sandbox

Please check the example by sandbox link

Preliminary steps which are performed in the example:

  1. set formatDate and parseDate attributes using moment (moment returns expected result)
  2. set minDate as new Date("0001-01-01T00:00:00.000Z")

scenario 1:

Steps to reproduce

  1. enter "0001-01-01" in the date input
  2. check date picker

Actual behavior

The date picker displays "1901" in the year select field and the day is not highlighted

Expected behavior

The date picker displays "1" in the year select field or "0001" and the picked day highlighted

image

scenario 2:

Steps to reproduce

  1. click on the input
  2. pick any two digits year or one digit year from the date picker, for example, "12"

Actual behavior

The input field displays "1912-01-01" and the date picker displays "1912" in the year select field

Expected behavior

The input field displays "0012-01-01" and the date picker displays "12" in the year select field or "0012"

image image

adidahiya commented 3 years ago

Acknowledging this is a bug, but it's low priority since that sounds like a rare use case. Most people are picking dates within 100 years of today. Related: https://github.com/palantir/blueprint/issues/877