Skip to content

Instantly share code, notes, and snippets.

@m4tx
Last active December 7, 2015 23:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m4tx/643f0d37591197ca0b20 to your computer and use it in GitHub Desktop.
Save m4tx/643f0d37591197ca0b20 to your computer and use it in GitHub Desktop.
javascript:(function() {
var pad = function(num) {
if (num < 10) {
return '0' + num;
}
return num;
};
var dateToString = function(date) {
return date.getFullYear() + '-'
+ pad(date.getMonth() + 1)
+ '-' + pad(date.getDate());
};
var first = new Date();
first.setDate(1);
var start = dateToString(first);
var last = new Date();
last.setMonth(last.getMonth() + 1);
last.setDate(0);
var end = dateToString(last);
var url = 'https://hubstaff.com/reports/my/custom?utf8=%E2%9C%93&group_by=date&commit=Apply&report_filters%5Bsum_date_ranges%5D=1&date=' + start + '&date_end=' + end;
document.location = url;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment