Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. func(currYear, currMonth, x) {
  2. yearDiff = x/12;
  3. monthDiff = x%12;
  4.  
  5. if (currMonth - monthDiff < 0) {
  6. yearDiff--;
  7. }
  8.  
  9. newMonth = currMonth - monthDiff < 0 ? 12 - (monthDiff - currMonth) + 1 : currMonth - monthDiff;
  10. newYear = year - yearDiff;
  11.  
  12. return ...
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement