Home > Software design >  How to change the default time of the date input field to a fixed value
How to change the default time of the date input field to a fixed value

Time:01-21

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 it is initially loaded it should not display any value

When clicking on the calendar icon instead of showing current date it should be pointing some other configurable date

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.

CodePudding user response:

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">

CodePudding user response:

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

  •  Tags:  
  • Related