You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
function days_passed(dt) {
|
|
var current = new Date(dt.getTime());
|
|
var previous = new Date(dt.getFullYear(), 0, 1);
|
|
|
|
return Math.ceil((current - previous + 1) / 86400000);
|
|
}
|
|
console.log(days_passed(new Date(2015, 0, 15)));
|
|
console.log(days_passed(new Date(2015, 11, 14)));
|