mominsamir / smDateTimeRangePicker

Angular Material Date Picker, DateTime Picker, Date Range Picker, Date Time range picker
http://mominsamir.github.io/smDateTimeRangePicker/
MIT License
130 stars 50 forks source link

The first load ng-model date is not formatted in controller (no resource callback) #74

Open pilouk opened 7 years ago

pilouk commented 7 years ago

I don't understand how to do this or if it's a bug but i try to load a date at start on my ng-model like below (Note there is no resource callback here)

$scope.CreatedDateDisplay = moment('2016-01-01');

The date actually appear in the input field but is not formatted as 'lll' which is the format i put in the sm-date-time-picker directive why ?

This is in my html

` <sm-date-time-picker flex="50"

                         on-focus
                         flex-xs="100"
                         fname="field"
                         disable-year-selection="true"
                         label="Creation date"
                         ng-model="CreatedDateDisplay"
                         is-required="{{true}}"
                         format="lll"
                         mode="date-time"
                         week-start-day="Monday"
                         on-date-selected-call="dtpCreatedDateSelected(date)">
    </sm-date-time-picker>

`

mominsamir commented 7 years ago

$scope.CreatedDateDisplay = moment('2016-01-01', 'yyyy-mm-dd');

try this and it should work

pilouk commented 7 years ago

Doesn't work either

navneet35371 commented 7 years ago

Even i am having the same issue with the range picker. When i am passing an having a initial value to the model it shows as [object Object].

mominsamir commented 7 years ago

@pilouk your issue is resolved with my latest commit. @navneet35371 i am first clearing issue realted to date Time picker and then will close your issue.