How to set the date in the Angular Date Range Picker to the 1st day of the month

At the moment is sets the default date to current date

In what manner would I be able to set the primary date extent to be first day of the month. How to set the date?

You could use

<script>
  var myFirstApp = angular.module('myFirstApp', []);
  myFirstApp.controller('myCtrl', function($scope) {
  $scope.getDateRange = function ( $object ){
   var manageDate = new Date();
   return {
    "startDateRes" : new Date(manageDate.getFullYear(), manageDate.getMonth(), 1),
    "endDateRes" : new Date(manageDate.getFullYear(), manageDate.getMonth() + 1, 0),
   } 
  };
  // function call
  $scope.dateRange = $scope.getDateRange( );
  console.log( $scope.dateRange.startDateRes );
  console.log( $scope.dateRange.endDateRes );
  });
</script>

Share this

Related Posts

Previous
Next Post »