Created
March 5, 2014 13:23
-
-
Save marcusandre/9367067 to your computer and use it in GitHub Desktop.
Do something every day from today for one week.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Module dependencies. | |
*/ | |
var moment = require('moment'); | |
// weekdays | |
var weekdays = [ | |
'sunday', | |
'monday', | |
'tuesday', | |
'wednesday', | |
'thursday', | |
'friday', | |
'saturday' | |
]; | |
// timers | |
var now = moment(); | |
var today = weekdays[now.weekday()]; | |
var n = 6; // monday + 6 == sunday | |
console.log(today); | |
while (n--){ | |
now = now.add('days', 1); | |
today = weekdays[now.weekday()]; | |
console.log(today); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment