Last active
August 29, 2015 14:15
-
-
Save ryanisinallofus/a99259446227376a8573 to your computer and use it in GitHub Desktop.
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
getLast12MonthsFromNow1 = function() { | |
return _.map(_.range(12), function(n) { | |
return { | |
name: moment().subtract(n, 'month').format('MMMM'), | |
value: moment().subtract(n, 'month').startOf('month').format('YYYY-MM-DD') | |
}; | |
}); | |
}; | |
getLast12MonthsFromNow2 = function() { | |
var months = [], | |
now = moment(); | |
for (var x = 0; x < 12; x++ ) { | |
months.push({ | |
name: now.format('MMMM'), | |
value: now.startOf('month').format('YYYY-MM-DD') | |
}); | |
now.subtract(1, 'month'); | |
} | |
return months; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment