Skip to content

Instantly share code, notes, and snippets.

@csalgueiro
Created January 28, 2014 10:03
Show Gist options
  • Save csalgueiro/8665010 to your computer and use it in GitHub Desktop.
Save csalgueiro/8665010 to your computer and use it in GitHub Desktop.
Calcular diferencia de dias en JS con datepicker
var start = $("#form_expedientes input[name='fecha']").datepicker('getDate');
var end = $("#form_expedientes input[name='fecha_entrega']").datepicker('getDate');
if(!start || !end)
return;
var days = 0;
if (start && end) {
days = Math.floor((end.getTime() - start.getTime()) / 86400000); // ms per day
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment