vitalets / angular-xeditable

Edit in place for AngularJS
http://vitalets.github.io/angular-xeditable
MIT License
1.91k stars 403 forks source link

round time issue with using Combodate #679

Closed chiu0602 closed 7 years ago

chiu0602 commented 7 years ago

html

<div ng-controller="CombodateCtrl">
  <a href="#" editable-combodate="user.dob">
    {{ (user.dob | date:"medium") || 'empty' }}
  </a>
</div>

controller.js

app.controller('CombodateCtrl', function($scope) {
  $scope.user = {
    dob: new Date(1984, 4, 15, 10, 11, 0)
  };
});

The view shows:

Apr 15, 1984 10:11:00 AM

and when the text is clicked, the minute field of combobox is set as "10" (as default minuteStep=5). After the tick (accept) is clicked, no change is shown for the view. It is expected

Apr 15, 1984 10:10:00 AM

shoulld be shown.

ckosloski commented 7 years ago

Hi @chiu0602, what are you expecting to happen when the minuteStep is 5? Do you expect it to round up instead of down?

chiu0602 commented 7 years ago

Hi @ckosloski, minuteStep is an attribute which is working fine, when the attribute with value 5, the combobox of minute shows 0,5,10,15,...,55 for user to select; when the attribute with value 15, the combobox of minute shows 0,15,30,45 for user to select.

Whether to round up or down the value depends on scenarios, I don't have comment on it. But when pressing the tick button, the selected value should be set as the variable value.

Thanks!

ckosloski commented 7 years ago

I see the issue. The scope value only gets changed when the onchange event is called for the selects. The value is never actually change, so nothing is propagated.

chiu0602 commented 7 years ago

Would anyone able to help to create a test case? I don't familiar with the unit test code and don't know how to create a control with desired value for me to test. Thanks.

ckosloski commented 7 years ago

I can help, maybe tomorrow or next week.

ckosloski commented 7 years ago

@eugef this can be closed, it was fixed by #682