I have a function that gets the birthdate( only day and month) and compares if its between 2 dates newsigndate is undefined.why? and also AriesFrom and AriesTo.
what to do?
I want to compare the birth date according to day and month for example is 21/3>21/2
yes
return Aries
thanks
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
function yourSign() {
var signDate = $("input[name='birthDate']").val();
tempsignDate = signDate.split("-").join("/");
newsignDate = tempsignDate.substring(5, 10);
var AriesDateFrom = "21/03";
var AriesDateTo = "20/04";
var Ad1 = AriesDateFrom.split("/");
var Ad2 = AriesDateTo.split("/");
var s = newsignDate.split("/");
//var date = new Date().getDay() + "/" + new Date().getMonth() + 1
var AriesFrom = new Date(Ad1[1], Ad2[2]);
newsignDate = new Date(s[1], s[2]);
if (newsignDate == "") {
alert("enter birthday");
} else if (newsignDate >= AriesFrom && newsignDate < AriesTo) {
$("#output").val("Aries");
}
}
</script>