Skip to content

Instantly share code, notes, and snippets.

@HusseinMorsy
Created July 22, 2016 11:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save HusseinMorsy/9665b1a0b7038721740e4e5f3a60a64a to your computer and use it in GitHub Desktop.
Save HusseinMorsy/9665b1a0b7038721740e4e5f3a60a64a to your computer and use it in GitHub Desktop.
ember-pikaday-demo
import Ember from 'ember';
import moment from 'moment';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
availableDates: [
new Date(2016,6,25),
new Date(2016,6,27),
new Date(2016,6,29)
],
availableDatesStr: Ember.computed('availableDates.@each', function() {
return this.get('availableDates').map((date)=> moment(date).format());
}),
actions: {
disableDay(day) {
/* für die include methode sollte die array elemente arrays sein
ansonstens funktioniert der vergleich nicht korrekt */
let availableDates = this.get('availableDatesStr');
return !availableDates.includes(moment(day).format());
}
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
{{pikaday-input options=(hash disableWeekends=true disableDayFn=(action 'disableDay'))}}
<br>
<br>
{
"version": "0.10.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.6.0",
"ember-data": "2.6.1",
"ember-template-compiler": "2.6.0"
},
"addons": {
"ember-pikaday": "2.1.0",
"ember-cli-moment-shim": "1.1.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment