Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

fix(input[date]): support years with more than 4 digits #13735

Closed
gkalpak opened this issue Jan 11, 2016 · 1 comment
Closed

fix(input[date]): support years with more than 4 digits #13735

gkalpak opened this issue Jan 11, 2016 · 1 comment

Comments

@gkalpak
Copy link
Member

gkalpak commented Jan 11, 2016

Currently, (mainly because of the REGEXPs used for parsing dates, e.g. here and there), date-family inputs do not support years with more than 4 digits (they consider the value invalid and the parser returns undefined).

According to the W3 spec, the value of a date-family input should be a "valid full-date as defined in [RFC 3339], with the additional qualification that the year component is four or more digits representing a number greater than 0" (emphasis mine).

Additionally, ISO 8601 allows (upon agreement of the involved parties) to have expanded representation of years (with more than 4 digits); see for example sections 2.3.8 and 4.1.2.4.

Current browser support:

  • Chrome, Opera: Support date inputs and years greater than 9999.
  • Firefox, IE: Do not support date inputs, but the user can still enter the dates in ISO format and ngModel parses them correctly
  • Edge: Supports date inputs, but not years greater than 9999.
  • Safari: ???

There's nothing we can do for MS Edge on the Angular side, but the users of other browsers will still benefit from adding support for years greater than 9999.

@gkalpak gkalpak added this to the 1.5.x - migration-facilitation milestone Jan 11, 2016
@gkalpak gkalpak changed the title feat(input[date]): support years with more than 4 digits fix(input[date]): support years with more than 4 digits Jan 11, 2016
@Narretz
Copy link
Contributor

Narretz commented Jan 11, 2016

Safari 9 has no special date input handling. ios9 has a datepicker input, and you can't actually enter the date by hand (at least not in Saucelabs).

gkalpak pushed a commit that referenced this issue Feb 10, 2016
Previously, the date-related regular expressions only matched years with no more than 4 digits.
This commit adds support for years with more than 4 digits. It also resolves an ambiguity in
`ISO_DATE_REGEXP` by matching the whole string (when it previosuly allowed extra characters around
the date string).

Fixes #13735
Closes #13905
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants