I'm using datepicker for Bootsrap3... also I'm using inputmask so my input looks like this.
<input type="text" class="form-control m_mm_yyyy" name="m_mm_yyyy" id="m_mm_yyyy" required="" data-inputmask="'alias': 'mm/yyyy'" data-mask/>
until that everything is fine, the thing is that using jquery, how do I calculate years and months based on that input information, so rule is that the result from that input must not be lest than 3 months nor higher than 9 years from the current day... I can get an alert or display a div that wont matter the thing is that the form wont be submit until that date is fix with a correct date...
I have try this: https://stackoverflow.com/a/2209104/2293454
and this: https://stackoverflow.com/a/14276675/2293454
but are not working for me, anyone have an idea how to do this? please.
btw I'm using this to trigger the alert or message when the rule happens...
<script>
$(function() {
// Masck my Dates as mm/YYYY
$("#m_mm_yyyy").inputmask("mm/yyyy", {"placeholder": "mm/yyyy"});
$(".m_mm_yyyy").focusout(function() {
// Here goes the rule for getting months and years
// var fg = $("#m_mm_yyyy").val();
alert(fg); // Working
// Now what? ... Have no idea how to calculate months
// and year base on that input...
})
});
</script>
Thank you for taking the time.