marmelab / ng-admin

Add an AngularJS admin GUI to any RESTful API
http://ng-admin-book.marmelab.com/
MIT License
3.95k stars 725 forks source link

maDateField timezone adjustment. Fixes #1271 #1305 #1317

Closed matheo closed 7 years ago

matheo commented 7 years ago

There's an infinite loop $watching value and rawValue, because the Date object adjust the yyyy-mm-dd value to the user's timezone, then modifying the original value +- the timezone. This patch adjust the timezone, so the rawValue is kept as the original value.

Kmaschta commented 7 years ago

There is an infinite loop, but it isn't due to the timezone but by a circular watch between two fields of the same scope.

I fix it with the PR #1318, which supersede this one.

Thanks for contributing!

matheo commented 7 years ago

Infinite loop caused by the timezone changing the original value, indeed, inside the circular watch. Once Date() changes the rawValue, it's all messed up, but the angular.equals check seems legit to prevent that too.

I confirmed that 1.0.1 works, thanks a lot! Best regards