AlexFF1
AlexFF1

Reputation: 1283

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

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"}}

Upvotes: 3

Views: 9556

Answers (1)

Pankaj Parkar
Pankaj Parkar

Reputation: 136154

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);

Upvotes: 1

Related Questions