jakkor / ember-cli-flatpickr

This addon is a wrapper for flatpickr date picker.
MIT License
1 stars 3 forks source link

Data-binding #2

Open ngelx opened 8 years ago

ngelx commented 8 years ago

Hi, I've got a test app with a model Trip that got some attr:

import DS from 'ember-data';
import Ember from 'ember';

export default DS.Model.extend({
  ...
  startDate: DS.attr('date'),
  endDate: DS.attr('date'),
  ....

I would like to use this addon to handle the startDate and endDate attr on trip forms, so i did something like this:

 {{flat-pickr
                  altInput=true
                  altFormat="F j, Y"
                  dateFormat="M/D/Y"
                  enableTime=true
                  hourIncrement=1
                  maxDate=trip.endDate
                  minuteIncrement=10
                  timeFormat="H:m"
                  value=trip.startDate}}

It works as expected except for 2 things.

  1. The input is not bind to the file. That mean that when I change the date using the calendar, the model field is not updated, even i've set it on the value option.
  2. Same for maxDate and minDate, the options are set ok on flatpickr init, but they are not updated when the values changes.

I'm doing something wrong? Are those features supported?

Thanks in advance Angel

Swizz commented 8 years ago

Hi,

I am encountering the same issue. I have a trail to solve this, I will make a PR within days.

Cheers,

jakkor commented 8 years ago

Hi, You can check other extension for flatpickr: https://github.com/shipshapecode/ember-flatpickr I am not working too much on this one to be honest.

Swizz commented 8 years ago

Ow.

I didnt seek so far. I used the first ember-flatpicker I was fallen in. It seem to be more mature. I will migrate on it.

Thank you.