ember-cli-bootstrap-datepicker icon indicating copy to clipboard operation
ember-cli-bootstrap-datepicker copied to clipboard

Bind a date to Ember CLI datepicker

Open lewis-mhi opened this issue 9 years ago • 2 comments

I would like to bind the following date to a date picker. Any idea? Thanks.

date value: 2014-12-31T00:00:00

html: {{bootstrap-datepicker autoclose=true value=model.date format="yyyy/mm/dd" class="form-control" placeholder="Select a date" clearBtn=true todayHighlight=true}}

lewis-mhi avatar Nov 04 '15 03:11 lewis-mhi

And what's the problem? If value is an Date object everything should be fine.

jelhan avatar Nov 18 '15 12:11 jelhan

@lewis-mhi all you need to to do is convert you ISO8601 string into a Date object.

Date object can parse ISO8601 date representation correctly. However you need to keep in mind that it uses your local timezone.

Example:

new Date('2014-12-31T00:00:00') // => Wed Dec 31 2014 01:00:00 GMT+0100 (CET)

soulim avatar Mar 04 '16 09:03 soulim