Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Change datetime individual #6666

Closed
jimmywarting opened this issue Mar 13, 2014 · 3 comments
Closed

Change datetime individual #6666

jimmywarting opened this issue Mar 13, 2014 · 3 comments

Comments

@jimmywarting
Copy link
Contributor

When a date object is bound to date/time/week/month and the value is updated via one of these input controls then the date object is reset to the beginning of time.

    app.controller('MainCtrl', function($scope) {
      $scope.date = new Date();
    });

    <input type="date" ng-model="date">
    <input type="time" ng-model="date">
    <input type="week" ng-model="date">
    <input type="month" ng-model="date">
    <input type="datetime-local" ng-model="date">

Change the date/time/week and you'll see that it resets.

http://plnkr.co/edit/WTZtQG96D7qEbd310Y0d?p=preview

@IgorMinar
Copy link
Contributor

I agree. We should update part of the full object rather than reset it to 0

@IgorMinar
Copy link
Contributor

I updated the description to make it easier to understand the problem.

@IgorMinar IgorMinar added this to the 1.3.0 milestone Mar 18, 2014
@SekibOmazic
Copy link
Contributor

@IgorMinar I've tried to work on this issue but I didn't come too far. The datetime-local, time, date and co. all use the same functions (createDateInputType and createDateParser) just with different RegEx. To make it even funnier datetime-local works as expected (doesn't reset the time to 00:00). Could you please give a hint?

And there is also one special thing about the type 'time'. The documentation says: "... this binding will always output a Date object to the model of January 1, 1900, or local date new Date(0, 0, 1, HH, mm)...". So changing the time in the second field in the plunker will reset the date to January 1, 1900.

@btford btford removed the gh: issue label Aug 20, 2014
@btford btford self-assigned this Aug 28, 2014
btford added a commit to btford/angular.js that referenced this issue Sep 3, 2014
btford added a commit to btford/angular.js that referenced this issue Sep 4, 2014
btford added a commit to btford/angular.js that referenced this issue Sep 5, 2014
btford added a commit to btford/angular.js that referenced this issue Sep 10, 2014
btford added a commit to btford/angular.js that referenced this issue Sep 10, 2014
@btford btford closed this as completed in 1a1ef62 Sep 10, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.