Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
App.PickADate = Ember.View.extend({
attributes: ['monthsFull', 'monthsShort', 'weekdaysFull', 'weekdaysShort',
'monthPrev', 'monthNext', 'showMonthsFull', 'showWeekdaysShort', 'today',
'clear', 'format', 'formatSubmit', 'hiddenSuffix', 'firstDay', 'monthSelector',
'yearSelector', 'dateMin', 'dateMax', 'datesDisabled', 'disablePicker'],
events: ['onOpen', 'onClose', 'onSelect', 'onStart'],
tagName: 'input',
classNames: 'pickadate',
didInsertElement: function() {
var options = {};
var self = this;
this.get('events').forEach(function(event) {
var callback = self[event];
if (callback) {
options[event] = callback
this.get('attributes').forEach(function(attr) {
if (self[attr] !== undefined) {
options[attr] = self[attr];
var onSelectCallback = options.onSelect;
options.onSelect = function() {
Ember.set(self, 'value', this.getDate(true));
if (onSelectCallback) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.