Skip to content

Instantly share code, notes, and snippets.

@chrismeller
Last active August 29, 2015 14:06
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 chrismeller/ae453245ff5a8d878c55 to your computer and use it in GitHub Desktop.
Save chrismeller/ae453245ff5a8d878c55 to your computer and use it in GitHub Desktop.
Bookmarklet for Jumping to Harvest Monthly Report
javascript:
var this_month = new Date();
var first_day = new Date(this_month.getFullYear(), this_month.getMonth(), 1);
var last_day = new Date(this_month.getFullYear(), this_month.getMonth() + 1, 0);
var first_year = first_day.getFullYear();
var first_month = first_day.getMonth();
var first_date = first_day.getDate();
var last_year = last_day.getFullYear();
var last_month = last_day.getMonth();
var last_date = last_day.getDate();
first_month = first_month + 1;
last_month = last_month + 1;
first_month = (new String(first_month).length < 2) ? '0' + first_month : first_month;
first_date = (new String(first_date).length < 2) ? '0' + first_date : first_date;
last_month = (new String(last_month).length < 2) ? '0' + last_month : last_month;
last_date = (new String(last_date).length < 2) ? '0' + last_date : last_date;
var url = 'https://chrismeller.harvestapp.com/reports?kind=month&from=' + first_year + first_month + first_date + '&till=' + last_year + last_month + last_date;
window.location = url;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment