I load in a SQL format date into a variable "2014-02-28" , but when I create a
new Date("2014-02-28");
the Date displayed in the input box is:
2014-02-27
In the AngularUI datepicker, the date is always one day off even if the value is correct in the model. Is there some way to remedy this?
Here is a Plunkr link which demonstrates the problem: http://plnkr.co/edit/evBwPW0KO7cEWGp6vqtk?p=preview
I would like the model to be just the date in yyyy-MM-dd format, and for the date to be correct.
Changing the Date format to
yyyy/MM/dd
fixed the problem
var date = new Date("2014-02-28"); // date loaded in SQL format
date.replace(new RegExp("-", 'g'),"/"); // now datepicker will show correct date