'JavaScript Date UTC datetime-local

I have a form where user can set a date and time with input format datetime-local. When the form is submitted an error appears for the start-date "Value must 11:52 AM or earlier". My local time is 13:52. I have to select -2 hours. How can I remove this problem?

The form is limited for the start date to select only today and last 72 hours, same for end time.

<input type="datetime-local" name="start_timestamp" id="start_timestamp" required>
<input type="datetime-local" name="end_timestamp" id="end_timestamp" required>

<script>
    //Do not let to select END-TIME and START TIME  in the PAST
    var today = new Date();
    var past = new Date(today.setDate(today.getDate() - 3)).toISOString().slice(0, 16);
    var today = new Date().toISOString().slice(0, 16);

    document.getElementsByName("start_timestamp")[0].min = past;
    document.getElementsByName("start_timestamp")[0].max = today;
</script>

<script>
    var today = new Date();
    var future = new Date(today.setDate(today.getDate() + 3)).toISOString().slice(0, 16);
    var today = new Date().toISOString().slice(0, 16);

    document.getElementsByName("end_timestamp")[0].min = today;
    document.getElementsByName("end_timestamp")[0].max = future;
</script>

I have an image also:

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source