User:Opencooper/streakCalendar.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// IDEA: On user pages, show the user's activity over the past 30 days
//       Helps you quickly see how active they are at a glance because you otherwise have to look through their contribs.
//       Purpose is not to encourage editcount-itis, wikiholism, or general dick-measuring
//       500 limit helps hedge against power users, but could also artificially limit it
//       or make it not 30 days
// Inspiration: GitHub's streak
//     https://github.com/isaacs/github/issues/627
// Limitation: Max 500 revs from API

// Docs: https://www.mediawiki.org/w/api.php?action=help&modules=query%2Busercontribs
// https://en.wikipedia.org/w/api.php?action=query&format=json&list=usercontribs&ucuser=Opencooper&ucprop=timestamp&uclimit=max&ucend=2019-11-11T00:00:00Z

var currentDate = new Date();
var pastDate =  new Date();
var dateOffset = currentDate.getUTCDate - 30;
monthAgo.setUTCDate(dateOffset);
// .toISOString()