Created
July 12, 2018 14:51
-
-
Save josemalcher/71b13f4354616c0afd95c4e619c12346 to your computer and use it in GitHub Desktop.
Verificação de Datas JS/Jquery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/**************************************************************************** | |
* Verificação de Datas | |
* https://www.w3schools.com/js/js_dates.asp | |
* https://www.w3schools.com/js/js_date_methods.asp | |
* https://pt.stackoverflow.com/questions/191886/n%C3%A3o-permitir-a-inser%C3%A7%C3%A3o-de-uma-data-posterior-a-outra-j%C3%A1-inserida | |
* **************************************************************************/ | |
$('#expedicao').on('focusout', function(){ | |
var dateObj1 = new Date($('#expedicao').val()); | |
if(dateObj1.getFullYear() < 1930 ){ | |
$(this).css({color: 'red'}); | |
$(this).focus(); // Volta o foco para o segundo input | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment