ng-admin: editionView() returns date decremented by 1 day
Description
In my index.js:
project.editionView().fields([
nga.field('devdate', 'date')
.format('MM-dd-yyyy')
.label('Development Date'),
]);
The day (dd) is decremented by 1 but the above works fine (displays the correct devdate
response) in project.creationView().fields
.
Steps to Reproduce
Plunkr: http://plnkr.co/edit/M70PbzPLBCGVZ9dollvj?p=preview
- Set the browser to CST or any timezone less than GMT
- Select ‘Projects’ in the left hand pane
- Select ‘Id’ of any of the projects in the Project List; notice the ‘Dev Date’
- Now in the Edit Project form, the ‘Development Date’ displays decremented by 1 day
- If user chooses to save, the ‘Dev Date’ will be stored in the db incorrectly.
I’ve tried it with and without the .format
and .label
with the same results. Again, creationView works just fine. And the datepicker requests with the devdate:"2016-12-08"
so it is stored in the database accurately.
Expected behavior: Display 12-07-2016
Actual behavior: Displays 12-06-2016
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 31 (14 by maintainers)
I’m experiencing a similar problem with my Datepicker field, the value field is inconsistent with what I selected. I selected January 1, 2015, the field value changed to June 21, 2015. I’m also getting “Error: 10 $digest() iterations reached.” in my console log. The later error could be my app specific.
I pinpointed the error down to these codes. My $digest error disappeared when I commented out the $watch statement.
The solution that I came up with is to unregister $watch() instead of return inside the IF conditions. Replace the above statement with these codes.
@wannarka @Phocea @Kmaschta @fzaninotto Can you please confirm the fixed and merge it to master? It is a critical bug.