Created
June 7, 2023 15:08
-
-
Save coulterpeterson/a17087bc00e4df1d4b1ec0c7ab52558b to your computer and use it in GitHub Desktop.
Bookmarklet to Save Dynamic HelpScout Report Links, Such As a "This Week" Date Range
This file contains hidden or 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
/* | |
* Instructions: adjust the URL of the report based on your needs, then copy/paste this code into the "URL" field of a | |
* fresh browser bookmark. Whenever you click it, it will automatically ensure the date range is set to "this week". | |
*/ | |
javascript: (() => { | |
let currentDate = new Date(); | |
currentDateIso = currentDate.toISOString().split('T')[0]; | |
/* Get the Monday of this week; credit: https://stackoverflow.com/a/4156516 */ | |
monday = new Date(); | |
var day = monday.getDay(), | |
diff = monday.getDate() - day + (day == 0 ? -6:1); /* adjust when day is sunday */ | |
monday = new Date(monday.setDate(diff)); | |
mondayIso = monday.toISOString().split('T')[0]; | |
location.href = `https://secure.helpscout.net/reports/company/?sort=replies&lowToHigh=false&range=0&startDate=${mondayIso}&endDate=${currentDateIso}&cmpRange=-1&cmpStartDate=&cmpEndDate=`; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment