logbon72 / angular-material-datetimepicker

Datepicker for Angular Material, mimick's Android's date time picker
https://logbon72.github.io/angular-material-datetimepicker
MIT License
169 stars 123 forks source link

Value its not same with input #100

Closed adirizky54 closed 11 months ago

adirizky54 commented 7 years ago

When i'm input 12/12/2016 the value from that input was "2016-12-12T05:23:00:000Z" Sorry, bad english

hexadecy commented 7 years ago

In the demo for the ng-model it's the current date-time: $scope.date = new Date();

For your case, use something like this: $scope.date = moment().startOf('day');

adirizky54 commented 7 years ago

Thanks its work, but if i change date. The result is same as before

hexadecy commented 7 years ago

Ok this seems to be an issue then: https://github.com/logbon72/angular-material-datetimepicker/blob/master/js/angular-material-datetimepicker.js#L142

I think we should add:

if (scope.time) {
    scope.currentDate = moment(scope.currentDate, scope.format);
} else {
    scope.currentDate = moment(scope.currentDate, scope.format).startOf('day');
}
hexadecy commented 7 years ago

@adirizky31 are you using the mdcDateTimeDialog? I've played with the demo, when the time is set before. It will not move after, when there is no clock picker at least.