Days without major incidents
3508
// One day Time in ms (milliseconds)
let one_day = 1000 * 60 * 60 * 24;
// To set present_dates to two variables
let present_date = new Date();
// 0-11 is Month in JavaScript
let christmas_day =
new Date(present_date.getFullYear(), 11, 25);
// To Calculate next year's Christmas if passed already.
if (present_date.getMonth() ==
11 && present_date.getDate() > 25) {
christmas_day.setFullYear(christmas_day.getFullYear() + 1);
}
// To Calculate the result in milliseconds and
// then converting into days
let Result = Math.round((christmas_day.getTime() -
present_date.getTime()) / one_day);
// To remove the decimals from the (Result)
// resulting days value
let Final_Result = Result.toFixed(0);
// To display the final_result value
console.log("Number of days remaining till Christmas:\n" +
present_date.toDateString() + " and " +
christmas_day.toDateString() +
" is: " + Final_Result + " days");