angular-material-datetimepicker icon indicating copy to clipboard operation
angular-material-datetimepicker copied to clipboard

Value its not same with input

Open adirizky54 opened this issue 8 years ago • 4 comments

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

adirizky54 avatar Mar 23 '17 05:03 adirizky54

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');

hexadecy avatar Mar 23 '17 05:03 hexadecy

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

adirizky54 avatar Mar 23 '17 06:03 adirizky54

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 avatar Mar 23 '17 20:03 hexadecy

@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.

hexadecy avatar Mar 26 '17 02:03 hexadecy