1

Here's the problem with my datepickers.I tried three approaches which ultimately gave same wrong result.

Input type date:

 <input type="date" ng-model="d.e_date" class="date"/>

Result: returned 2016-03-31 on choosing 1 April 2016 and 2016-04-06 on choosing 7April 2016.(One Day Back)

UI Bootstrap's datepicker and Jquery's datepicker:

Result: they also gave same result for format "yyyy/MM/dd".while i used them with format "MM/yyyy" and they returned 12/2013 on choosing January 2014 and 11/2015 on choosing December 2015.

Conclusion: As far as i could understand,it is somehow subtracting one point.like one day back in full date format and one month back in month's format.

datepicker date off by one day

This is the link i checked and also tried replacing "-" with "/" as mentioned in above post but no luck.

Update:

I am actually getting this date value in Angular controller and sending it to server.In Controller date is returned in "Thu Apr 01 2010 00:00:00 GMT+0500" on choosing 1st april 2010 while when its is submitted to service as

console.log($scope.s_month);// returns this Thu Apr 01 2010 00:00:00 GMT+0500

Restangular.all("s_session/create").post({s_month:$scope.s_month}).then(function(response){
            console.log(response);
        });//returns '2010-03-31T19:00:00.000Z' according to browser's network tab.
Stephen Docy
  • 4,738
  • 7
  • 18
  • 31
N.A
  • 855
  • 4
  • 13
  • 34

0 Answers0