angularjs - Adding additional day in array to correct date format in angular -
in angular project, have array this:
thali : [ {"date":"2017-04-09t18:30:00.000z","isholiday":"100"}, {"date":"2017-04-10t18:30:00.000z","isholiday":"101"} ]
from date picker selected first value 2017-04-10
(10 april) , in isodate
format shows 1 day less. need add 1 day in date array. how can add 1 day in dates of array or able change format of isodate
?
here solution using pure javascript
var arr = [ {"date":"2017-04-09t18:30:00.000z","isholiday":"100"}, {"date":"2017-04-10t18:30:00.000z","isholiday":"101"} ] arr.foreach(function(entry) { var d = new date(entry["date"]); // add 1 day d.setdate(d.getdate() + 1); // replace existing date in array new 1 entry["date"] = d.toisostring() }) console.log(arr);
Comments
Post a Comment