Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function shift(){
- var oneDay = 24*60*60*1000; // hours*minutes*seconds*milliseconds
- var ashift = new Date(2015,08,15);
- var bshift = new Date(2015,08,16);
- var cshift = new Date(2015,08,17);
- var today = new Date();
- today.setHours(0,0,0,0);
- var ashift = Math.round(Math.abs((ashift.getTime() - today.getTime())/(oneDay)));
- var bshift = Math.round(Math.abs((bshift.getTime() - today.getTime())/(oneDay)));
- var cshift = Math.round(Math.abs((cshift.getTime() - today.getTime())/(oneDay)));
- //diffDays % 2;
- if(ashift % 3 === 0){
- return "A shift";
- }else if(bshift % 3 === 0){
- return "B shift";
- }else if(cshift % 3 === 0){
- return "C shift";
- }else{
- return "unkown shift";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement