soulim / ember-cli-bootstrap-datepicker

Datepicker component for Ember CLI
http://sul.im/ember-cli-bootstrap-datepicker
MIT License
68 stars 57 forks source link

Wrong date value submitted #114

Open belgoros opened 6 years ago

belgoros commented 6 years ago
screen shot 2018-04-30 at 09 43 09

Here is how the date-picker is defined in a component:

# templates/components/holiday-hour.hbs
..
{{bootstrap-datepicker value=holiday.date class='form-control' autoclose=true language=currentLanguage format="dd/mm/yyyy"}}

Here is component itself with currentLanguage CP set up:

# components/holiday-hour.js

import Component from '@ember/component';
import { inject as service } from '@ember/service';
import { computed } from '@ember/object';

export default Component.extend({
  i18n: service('i18n'),
  constants: service(),
  holiday: null,
  state: null,
  states: [],
  tagName: '',
  currentLanguage: '',

  init() {
    this._super(...arguments);
    this.states = this.get('constants.states');
    this.currentLanguage = this.get('i18n').get('locale');
  },
....

When I select the 30th of April 2018 (30/04/2018), the sent value is wrong:

2018-04-29T22:00:00.000Z

Ember version:

ember-cli: 3.1.2
node: 8.9.1
os: darwin x64
jQuery: 3.3.1
de-don commented 6 years ago

I have same problem