Created
December 15, 2014 17:15
-
-
Save Jhony0311/c4655a41d810ff0fd670 to your computer and use it in GitHub Desktop.
Dynamic Select for Years Handlebars Helper
This file contains hidden or 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
Handlebars.registerHelper('eachYear', function(options) { | |
var data = ''; | |
var d = new Date(); // Get user current date | |
var year = d.year; // Get year from date created; | |
for(var x = 1922; x <= year; x++) { | |
data = data + '<option value="' + x + '">' + x + '</option>'; | |
} | |
return data; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment