Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Native chrome datepicker. Six characters in year field

How can i limit a number of characters, that allowed in chrome datepicker year field? Fiddle of problem:

http://jsfiddle.net/L2r3wvt8/

<input type="date" value="201223-01-01">

(value is set for example, problem is - if user types a year value, it's not restarting after 4 symbols, but after 6)

like image 374
fiction Avatar asked Dec 08 '22 04:12

fiction


1 Answers

Browsers have no reasons to limit the year field to 4 digits by default. You should specify max attribute.

<input type="date" max="9999-12-31">
like image 70
int32_t Avatar answered Jan 08 '23 11:01

int32_t