The whole problem is to compare the date extracted from the database and passed to the input field in the template with today's date generated by jquery.
Unfortunately when I tried print startDt console return me "undefined value"
$(document).ready(function() {
let endDt = new Date();
$(".date").each(function() {
let startDt= $(this).attr('data-book').val;
if ((new Date(startDt).getTime() < new Date(endDt).getTime())) {
// Rest of code here
}
});
});
<input type="date" class="date" hidden data-book="{{ book.slug }}" value="{{ book.date|date:" Y-m-d " }}">