Ngx-bootstrap: Datepicker auto complete

Created on 2 Jul 2018  路  8Comments  路  Source: valor-software/ngx-bootstrap

Bug description or feature request:

When you enter a date eg. "010189" and hit enter then it autocompletes to 01/01/1989 which is okay but if you enter a date "010163" then it autocompletes to 01/01/2063.

This if for all dates before 01/01/1969

as designed can be closed? comp(datepicker) medium

Most helpful comment

i found the issue, it is located in the file:

src/chronos/units/year.ts - line 66

export function parseTwoDigitYear(input: string): number {
  return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
}

can the hard coded value 68 (and 1900, 2000) be changed to a configurable value?

All 8 comments

@SimonSch thanks for reporting!

Any update on this? This component is not usable for entering birthdays.

+1

+1

i found the issue, it is located in the file:

src/chronos/units/year.ts - line 66

export function parseTwoDigitYear(input: string): number {
  return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
}

can the hard coded value 68 (and 1900, 2000) be changed to a configurable value?

@valorkin please can you reassess the prio as this bug seems to affect quite a few people.

let's try to think about some solution (idea from @Konstruktour looks good, but, how to manage case, if I want to use both 1963 and 2063 in my datepicker, and then, type just 111163...) What the value should be here?

I see, that logic, used in ngx-bootstrap was made in the same way, as for moment.js

https://github.com/moment/moment/commit/e7483a75f857e4c8fe883fa1c4d15cbf3002b947

so maybe, this will not be fixed

Was this page helpful?
0 / 5 - 0 ratings