JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<form>
<input type="datetime-local" id="example"><br><br>
<button type="submit">Submit</button> <button type="button" id="fix">Fix</button>
</form><br>
<strong>Value:</strong> <span id="value"></span>
JavaScript
$(document).ready(function() {
$("#example").on("change", function() {
$("#value").text($("#example").val());
});
$("#fix").on("click", function() {
var current_value = $("#example").val();
var fixed_value = current_value.substr(0, current_value.length - 3);
$("#example").val(fixed_value);
$("#value").text($("#example").val());
});
});