katemihalikova / ion-datetime-picker

Date and/or time picker for awesome Ionic framework
MIT License
169 stars 101 forks source link

Option to show only working days in calendar month popup ?? #82

Closed MayankLogiciel closed 7 years ago

MayankLogiciel commented 7 years ago

is it possible to disable all sundays & saturdays and some particular dates in a month calendar view? I read the documentation and didn't find any option to achieve this.

Actually i want to show only working days(Monday-Friday) in a calendar month. Can you guide me to do that in the awesome plugin you made 👍

katemihalikova commented 7 years ago

Current implementation of disabling particular dates is not powerful enough to achieve what you want.

As a workaround, you can hide Saturday and Sunday columns via css:

.ion-datetime-picker {
  .calendar {
    .col:nth-child(1), .col:nth-child(7) {
      display: none;
    }
  }
}

(or children numbered 6 and 7 if using monday-first).

Please note that it is not perfect solution as it is still possible to select a weekend date by changing time, month or year. You should add your own ngModel validator and show some error message in your UI then.

MayankLogiciel commented 7 years ago

Thanks kate for your quick response and css fix. That will help :)