Skip to content

Instantly share code, notes, and snippets.

@josemalcher
Created July 12, 2018 14:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josemalcher/71b13f4354616c0afd95c4e619c12346 to your computer and use it in GitHub Desktop.
Save josemalcher/71b13f4354616c0afd95c4e619c12346 to your computer and use it in GitHub Desktop.
Verificação de Datas JS/Jquery
/****************************************************************************
* 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