Skip to content

Commit

Permalink
feat(firstDay): ability to change week starting calendar with locale.…
Browse files Browse the repository at this point in the history
…firstDay

Close #9
  • Loading branch information
fetrarij committed Jun 10, 2018
1 parent caf5635 commit bf5ba84
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/daterangepicker/daterangepicker.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ export class DaterangepickerComponent implements OnInit {
}

ngOnInit() {
if (this.locale.firstDay != 0) {
var iterator = this.locale.firstDay;
while (iterator > 0) {
this.locale.daysOfWeek.push(this.locale.daysOfWeek.shift());
iterator--;
}
}
this.renderCalendar(SideEnum.left);
this.renderCalendar(SideEnum.right);
this.renderRanges();
Expand Down Expand Up @@ -173,7 +180,6 @@ export class DaterangepickerComponent implements OnInit {
if (startDay > daysInLastMonth) {
startDay -= 7;
}

if (dayOfWeek === this.locale.firstDay) {
startDay = daysInLastMonth - 6;
}
Expand Down

0 comments on commit bf5ba84

Please sign in to comment.