Localising the date value in Angular Material datepicker
<p>I'm working with Angular Material date picker. My problem is that when I send a date to the Web Api controller, I get a date less than the date I have selected in my form. I think this is due to the fact that the date value is not being localized. What I want to know is that how to <strong>localize</strong> the <strong>date</strong> in <strong>angular js</strong></p>

<p><strong>HTML:</strong></p>

<pre><code>&lt;div ng-controller="AppCtrl" style='padding: 40px;' ng-cloak&gt;
  &lt;md-content&gt;
    &lt;h4&gt;Standard date-picker&lt;/h4&gt;
    &lt;md-datepicker ng-model="myDate" md-placeholder="Enter date"&gt;&lt;/md-datepicker&gt;
&lt;/md-content&gt;
&lt;/div&gt;
</code></pre>

<p><strong>Controller:</strong></p>

<pre><code>angular.module('datepickerBasicUsage',
    ['ngMaterial', 'ngMessages']).controller('AppCtrl', function($scope) {
  $scope.myDate = new Date();
  $scope.minDate = new Date(
      $scope.myDate.getFullYear(),
      $scope.myDate.getMonth() - 2,
      $scope.myDate.getDate());
  $scope.maxDate = new Date(
      $scope.myDate.getFullYear(),
      $scope.myDate.getMonth() + 2,
      $scope.myDate.getDate());
  $scope.onlyWeekendsPredicate = function(date) {
    var day = date.getDay();
    return day === 0 || day === 6;
  }
});
</code></pre>