Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is the html input type="datetime-local" value of YEAR 7 chars long?

Im have to do a Website-Project and i will use the input type "datetime-local" to choose a date+time. When i write some Numbers in it, the YEAR will always have 7 characters (instead of 4).

How can i change this?

Greetings

like image 434
Buh Avatar asked Oct 27 '25 14:10

Buh


1 Answers

HTML specification doesn't define the upper limit of dates for <input type=datetime-local>. However, ECMA Script defines the upper limit of Date object. It's September 13 275,760.

You can set the upper limit in your HTML, and Google Chrome shrinks the year field if it's less than 6 digits.

<input type="datetime-local" max="9999-12-31T23:59">
like image 151
int32_t Avatar answered Oct 30 '25 05:10

int32_t



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!