I created a mask for input date field, but when someone type yearFrom in this format dd.mm.yyyy(28.45.2020), so I need when user switch to another field yearTo it need to showed him an error on input field yearFrom (Your date format is wrong) or something else.
<div class="col-md-6">
  Year_from
  @Html.TextBoxFor(model => model.yfrom, new { @class = "form-control", maxlength = "10", minlength="4" })
</div>
<div class="col-md-6">
  Year_to 
  @Html.TextBoxFor(model => model.yto, new { @class = "form-control", maxlength = "10", minlength = "4" })
</div>
My js:
<script type="text/javascript">
  $(document).ready(function () {
    $('#yfrom').mask('00.00.0000');
    $('#yto').mask('00.00.0000');
  });
</script>
