Skip to content

Instantly share code, notes, and snippets.

@jelhan
Created August 15, 2016 18:22
Show Gist options
  • Save jelhan/7ff74a9f6ee7028dbf712b2b02ba06b5 to your computer and use it in GitHub Desktop.
Save jelhan/7ff74a9f6ee7028dbf712b2b02ba06b5 to your computer and use it in GitHub Desktop.
ember-bootstrap-datepicker with momentjs
import Ember from 'ember';
const { computed } = Ember;
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
date: computed('model', {
get() {
return this.get('moment').toDate();
},
set(i, date) {
this.set('moment', moment(date));
return date;
}
}),
moment: computed.alias('model')
});
import Ember from 'ember';
export default Ember.Route.extend({
model() {
return moment('2016-01-01');
}
});
<h1>Welcome to {{appName}}</h1>
{{bootstrap-datepicker value=date}}
{{moment}}
{
"version": "0.10.4",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"moment": "https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.14.1/moment.js",
"ember": "2.6.2",
"ember-data": "2.7.0",
"ember-template-compiler": "2.6.2"
},
"addons": {
"ember-cli-bootstrap-datepicker": "0.5.5"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment