Mo.
Mo.

Reputation: 27465

How to hide decrement button for past month?

Previous month button should be hidden with ng-show="isPastMonth(calendarDate)" for past month form the current month.

Is there any option in the angular-bootstrap-calendar to hide decrement="calendarView" for past months ?

<button
  class="btn btn-primary"
  mwl-date-modifier
  date="vm.viewDate"
  decrement="vm.calendarView">
  Previous
</button>

Demo: http://plnkr.co/edit/LE4F4U7AnnD3tjM9ZH4G?p=preview

Upvotes: 0

Views: 59

Answers (1)

Mina paulis
Mina paulis

Reputation: 402

You can use

vm.previousMonth = angular.copy((vm.viewDate.getFullYear() * 12) + vm.viewDate.getMonth()) - 1;

//To get the previous month then to disable using this condition

ng-disabled="vm.previousMonth === ((vm.viewDate.getFullYear() * 12) + vm.viewDate.getMonth()) - 1"

Check it here http://plnkr.co/edit/NFI6tq?p=preview

Upvotes: 0

Related Questions