JSFiddle - React, Tailwind, and code Playground
HTML
<input id="first" value="1/1/2000"/>
<input id="second" value="1/1/2001"/>
<input id="abc" value=""/>
JavaScript
function parseDate(str) {
var mdy = str.split('/')
return new Date(mdy[2], mdy[0]-1, mdy[1]);
}
function daydiff(first, second) {
return (second-first)/(1000*60*60*24)
}
var newVal = (daydiff(parseDate($('#first').val()), parseDate($('#second').val())));
$('#abc').val(newVal);
$(document).ready(function() {
if (newVal <= '365') {
$('#abc').fadeOut('slow');
}
else if (newVal == '365') {
$('#abc').fadeOut('slow');
}
else if (newVal >= '366') {
$('#abc').fadeOut('slow');
}
});