diosney / angular-bootstrap-datetimepicker-directive

A wrapper directive around the bootstrap-datetimepicker component.
MIT License
69 stars 50 forks source link

unable to set initial date for calendar #9

Closed Kehet closed 8 years ago

Kehet commented 9 years ago

I'm trying to set initial value for field, so user can edit existing data in my app.

Here is my html

<div class="input-group date" 
     data-datetimepicker="" 
     data-datetimepicker-options="{{ datetimepicker_options }}">

    <input type="text" class="form-control"
           placeholder=""
           name="start_at"
           id="start_at"
           ng-model="event.start_at" />

    <span class="input-group-addon">
        <span class="glyphicon glyphicon-calendar"></span>
    </span>
</div>

And here js in controller

$scope.event = {
    start_at: moment('2013-12-24 09:00:00')
};

$scope.datetimepicker_options = {
    defaultDate: $scope.event.start_at
};

This shows correct date (without formatting) on text field when page is loaded. However datetimepicker have no idea it should have some specific day selected.

Am I missing some config value or just misunderstood how this should work?

planting commented 8 years ago

@Kehet I have the same issue, have you got it to work?

Kehet commented 8 years ago

@planting I had to do monkey patch and unfortunately I don't have access to that code any more

diosney commented 8 years ago

I'm quite busy right now and can't spend lot of time on this, any working PR will be welcome :)

Thanks