Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.