Baumann Baumann - 2 months ago 16
AngularJS Question

ui-bootstrap datepicker enable weekend days

at the moment my datepicker works fine. But I need to fix something.
Saturdays and Sundays days are disabled, so they can't be selected.

datepicker

As I know, the official documentaion says nothing about this feature. Maybe with template-url, but anyway dont know where to find it.

Any idea? I think it's really easy to solve it.

Since it's in spanish, I need to enable

sab.
and
dom.
columns.

Thanks.

Answer

If you refer the docs, disabled dates is achieved by:

JS:

// Disable weekend selection
 $scope.disabled = function(date, mode) {
    return ( mode === 'day' && ( date.getDay() === 0 || date.getDay() === 6 ) );
  };

HTML:

So, you can enable weekends by removing this chunk of code from your datepicker's code, i.e removing the date-disabled attribute passed to datepicker:

date-disabled="disabled(date, mode)"

Complete HTML:

<input type="date" class="form-control" uib-datepicker-popup ng-model="dt" is-open="status.opened" min-date="minDate" max-date="maxDate" datepicker-options="dateOptions" ng-required="true" close-text="Close" />
Comments