Skip to content

Instantly share code, notes, and snippets.

@christianbundy
Last active May 18, 2018 16:18
Show Gist options
  • Save christianbundy/cb680d042b6a63b8e9226c4df0420fc0 to your computer and use it in GitHub Desktop.
Save christianbundy/cb680d042b6a63b8e9226c4df0420fc0 to your computer and use it in GitHub Desktop.
var years = 4;
var d = new Date();
d.setMonth(0);
d.setDate(1);
var last = d.setHours(0, 0, 0, 0);
var next = d.setYear(d.getFullYear() + 1);
var dozenth = (next - last) / 12;
var months = [];
for (var i = 0; i <= years * 12; i++) {
months.push(new Date(last + dozenth * i))
}
console.log(months.join('\n'));
Mon Jan 01 2018 00:00:00 GMT-0800 (PST)
Wed Jan 31 2018 10:00:00 GMT-0800 (PST)
Fri Mar 02 2018 20:00:00 GMT-0800 (PST)
Mon Apr 02 2018 07:00:00 GMT-0700 (PDT)
Wed May 02 2018 17:00:00 GMT-0700 (PDT)
Sat Jun 02 2018 03:00:00 GMT-0700 (PDT)
Mon Jul 02 2018 13:00:00 GMT-0700 (PDT)
Wed Aug 01 2018 23:00:00 GMT-0700 (PDT)
Sat Sep 01 2018 09:00:00 GMT-0700 (PDT)
Mon Oct 01 2018 19:00:00 GMT-0700 (PDT)
Thu Nov 01 2018 05:00:00 GMT-0700 (PDT)
Sat Dec 01 2018 14:00:00 GMT-0800 (PST)
Tue Jan 01 2019 00:00:00 GMT-0800 (PST)
Thu Jan 31 2019 10:00:00 GMT-0800 (PST)
Sat Mar 02 2019 20:00:00 GMT-0800 (PST)
Tue Apr 02 2019 07:00:00 GMT-0700 (PDT)
Thu May 02 2019 17:00:00 GMT-0700 (PDT)
Sun Jun 02 2019 03:00:00 GMT-0700 (PDT)
Tue Jul 02 2019 13:00:00 GMT-0700 (PDT)
Thu Aug 01 2019 23:00:00 GMT-0700 (PDT)
Sun Sep 01 2019 09:00:00 GMT-0700 (PDT)
Tue Oct 01 2019 19:00:00 GMT-0700 (PDT)
Fri Nov 01 2019 05:00:00 GMT-0700 (PDT)
Sun Dec 01 2019 14:00:00 GMT-0800 (PST)
Wed Jan 01 2020 00:00:00 GMT-0800 (PST)
Fri Jan 31 2020 10:00:00 GMT-0800 (PST)
Sun Mar 01 2020 20:00:00 GMT-0800 (PST)
Wed Apr 01 2020 07:00:00 GMT-0700 (PDT)
Fri May 01 2020 17:00:00 GMT-0700 (PDT)
Mon Jun 01 2020 03:00:00 GMT-0700 (PDT)
Wed Jul 01 2020 13:00:00 GMT-0700 (PDT)
Fri Jul 31 2020 23:00:00 GMT-0700 (PDT)
Mon Aug 31 2020 09:00:00 GMT-0700 (PDT)
Wed Sep 30 2020 19:00:00 GMT-0700 (PDT)
Sat Oct 31 2020 05:00:00 GMT-0700 (PDT)
Mon Nov 30 2020 14:00:00 GMT-0800 (PST)
Thu Dec 31 2020 00:00:00 GMT-0800 (PST)
Sat Jan 30 2021 10:00:00 GMT-0800 (PST)
Mon Mar 01 2021 20:00:00 GMT-0800 (PST)
Thu Apr 01 2021 07:00:00 GMT-0700 (PDT)
Sat May 01 2021 17:00:00 GMT-0700 (PDT)
Tue Jun 01 2021 03:00:00 GMT-0700 (PDT)
Thu Jul 01 2021 13:00:00 GMT-0700 (PDT)
Sat Jul 31 2021 23:00:00 GMT-0700 (PDT)
Tue Aug 31 2021 09:00:00 GMT-0700 (PDT)
Thu Sep 30 2021 19:00:00 GMT-0700 (PDT)
Sun Oct 31 2021 05:00:00 GMT-0700 (PDT)
Tue Nov 30 2021 14:00:00 GMT-0800 (PST)
Fri Dec 31 2021 00:00:00 GMT-0800 (PST)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment