SHOW:
|
|
- or go back to the newest paste.
| 1 | var originalProceedWeek = General.proceedOneWeek; //store the original function as a variable | |
| 2 | var myProceedWeek = function(company, customweek) //create a new function that will override the old one | |
| 3 | {
| |
| 4 | originalProceedWeek(company, customweek); //call the original we stored | |
| 5 | ||
| 6 | if (company.currentWeek < 1) { //check if the date is before 1/1/2
| |
| 7 | //do something at 1/1/1 | |
| 8 | } | |
| 9 | - | else if (company.currentWeek % 4 === 0) { //check if the current week is divisible by 4, the number of weeks a month
|
| 9 | + | else if (company.currentWeek > 0 && company.currentWeek % 4 === 0) { //check if the date is later than 1/1/1 and the current week is divisible by 4, the number of weeks a month
|
| 10 | //do something every month | |
| 11 | } | |
| 12 | }; | |
| 13 | General.proceedOneWeek = myProceedWeek; //replace the original function |