简体   繁体   中英

How to change the default time of the date input field to a fixed value

When we open any date input field it will show us the current date if the variable associated with the input field is null. Is there any way to configure the input field so that when we open the calendar popup instead of showing the current time it should show some other time, still keeping the value associated with the input field to be null

最初加载时不应显示任何值

when it is initially loaded it should not display any value

单击日历图标而不是显示当前日期时,它应该指向其他一些可配置的日期

When clicking on the calendar icon instead of showing current date (21/01/2022) it should be pointing some other configurable date (suppose 25/01/2022).

It might seem useless to achieve this, but i have to use this functionality in my task.

I think you could be looking for this:

from https://developer.mozilla.org :

You can set a default value for the input with a date inside the value attribute, like so:

    <input type="date" value="2017-06-01">

If I understand correctly, you want a default value for the date picker. Then this should do:

<input type="date" id="start" name="trip-start"
       value="2018-07-22"
       min="2018-01-01" max="2018-12-31">

source

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM