Advertisement
nher1625

automate_my_job

May 11th, 2015
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. function moment() { return Date().split(' '); }
  3.  
  4. var firstMoment = moment();
  5.  
  6. document.getElementById('zeroDay').innerHTML = (Number(firstMoment[2]) + 1).toString();
  7. document.getElementById('endDay').innerHTML = (Number(firstMoment[2]) + 2).toString();
  8.  
  9. function checkFirstTime() {    
  10.     if ( Number(firstMoment[4].split(':')[0]) >= 1 ) {
  11.         document.getElementById('zeroDay').innerHTML = (Number(firstMoment[2]) + 2).toString();
  12.     }
  13.     return checkSecondTime();
  14. }
  15.  
  16. function checkSecondTime() {    
  17.     if ( (firstMoment[4].split(':')[0] === "01") && (Number(firstMoment[4].split(':')[1]) >= 0) ) {
  18.         document.getElementById('endDay').innerHTML = (Number(firstMoment[2]) + 3).toString();
  19.     }
  20.     //console.log("done");
  21. }
  22.  
  23. function isFriday() {
  24.     if (firstMoment[0] === "Fri")
  25.         document.getElementById('zeroDay').innerHTML = (zeroDay + 3).toString();
  26.     else if (firstMoment[0] === ("Sat" || "Sun"))
  27.         document.getElementById("endDay").style.visibility = "hidden";
  28.     return checkFirstTime();
  29. }
  30.  
  31. function isEndOfMonth() {
  32.     if (firstMoment[2] === ("30" || "31")) {
  33.     // Figure out end of month and think about leap years...
  34.     }
  35.     return isFriday()
  36. }
  37.  
  38. isEndOfMonth();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement