Skip to content

Instantly share code, notes, and snippets.

@marti1125
Created June 19, 2013 16:17
Show Gist options
  • Save marti1125/5815621 to your computer and use it in GitHub Desktop.
Save marti1125/5815621 to your computer and use it in GitHub Desktop.
DatePicker
Backbone.Form.editors.YearPicker = Backbone.Form.editors.Text.extend({
initialize: function(options) {
Backbone.Form.editors.Text.prototype.initialize.call(this, options);
//this.$el.addClass('datepicker input-small-custom');
},
getValue: function() {
var value = this.$el.val();
if (value) {
return moment(value).format('YYYY-MM-DD HH:mm:ss');
} else {
return '';
}
},
render: function() {
//Backbone.Form.editors.Text.prototype.render.apply(this, arguments);
this.$el.datepicker({
format: " yyyy",
viewMode: "years",
minViewMode: "years"
});
this.$el.attr('readonly','false');
return this;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment