Last active
September 24, 2015 17:36
-
-
Save deadlyhifi/b61af475613e2e7f4664 to your computer and use it in GitHub Desktop.
TimeStation current week hours snippet - for textexpander or something.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getTimeStationString() { | |
var today = new Date(); | |
var d = new Date(); | |
var day = d.getDay(), | |
diff = d.getDate() - day + (day == 0 ? -6:1); // adjust when day is sunday | |
var mon = new Date(d.setDate(diff)); | |
return 'https://www.mytimestation.com/User_Reports.asp?ReportID=20&Report_StartDate=' + formatDate(mon) + '&Report_EndDate=' + formatDate(today) + '&Report_DepartmentID=-1&ReportName=Department+Summary&ID=20&Submit=Run+Report'; | |
} | |
function formatDate(date) { | |
var dd = date.getDate().toString(), | |
mm = (date.getMonth()+1).toString(), | |
yy = date.getFullYear().toString(); | |
return (mm[1]?mm:"0"+mm[0]) + "%2F" + (dd[1]?dd:"0"+dd[0]) + "%2F" + yy; | |
} | |
getTimeStationString(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment