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

9.4k views Asked by At

Im using this Angular directive for date range picker

https://github.com/g00fy-/angular-datepicker

At the moment is sets the default date to current date

How can I set the first date range to be 1st day of the month. How to set the date?

<div date-range start="a" end="b"> </div>

{{(a|date)||"pick start"}} {{(b|date)||"pick end"}}
1

There are 1 answers

2
Pankaj Parkar On BEST ANSWER

You could use

var date = new Date();
$scope.a = new Date(date.getFullYear(), date.getMonth(), 1);
$scope.b = new Date(date.getFullYear(), date.getMonth() + 1, 0);