How to I set min and max value for Input with type='datetime-local'?

Example with min and max values

<input
    type="datetime-local"
    className="form-control mt-2"
    name="start_date"
    min="2011-02-20T20:20"
    max="2031-02-20T20:20"
/>

In spite of what is declared here I made it work adding seconds too, like yyyy-MM-ddThh:mm:ss

<input type="datetime-local" id="start-date" min="2021-06-07T14:47:57" />

I needed min input to be "today" so with JS:

let dateInput = document.getElementById("start-date");
dateInput.min = new Date().toISOString().split(".")[0];

Then calendar won't let you pass that min date. You can apply same code for max attribute.