Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove week column and button from Angular-ui bootstrap datepicker

I am using angular-ui bootstrap datepicker. Now I need to remove #(week) column and week button from datepicker. This date picker is being used in many forms of my application. I want to remove week column from all of them.

For this, I had globally configured the datepickerConfig (show-weeks) but still it is not working. Can anyone please let me know I am doing wrong with this?

like image 496
Dipesh Gandhi Avatar asked Dec 19 '13 09:12

Dipesh Gandhi


2 Answers

Please, look at this example: http://plnkr.co/edit/6i4G7JkvBiWXZYlrV2GL?p=preview

angular.module('app', ['ui.bootstrap'])
  .config(function (datepickerConfig) {
      datepickerConfig.showWeeks = false;
    });
like image 75
Gm0t Avatar answered Nov 02 '22 02:11

Gm0t


For datepicker in popup, datepicker-options attribute has value dateOptions in which json can be added for any datepicker settings as shown in the HTML below.

<input type="text" class="form-control" datepicker-popup="{{format}}" ng-model="dt" is-open="opened" min-date="minDate" max-date="'2015-06-22'" **datepicker-options="dateOptions"** date-disabled="disabled(date, mode)" ng-required="true" close-text="Close" />

In javascript this is given

 $scope.dateOptions = {
    formatYear: 'yy',
    startingDay: 1,
    
  };

just add showWeeks:false in dateOptions like this,

 $scope.dateOptions = {
    formatYear: 'yy',
    startingDay: 1,
    showWeeks:false
  };

or you can add like this 'show-weeks':'false' . Demo is shown at plunker [http://plnkr.co/edit/qbp3IObj13op2RS17IEg?p=preview][1]

like image 12
shruti Avatar answered Nov 02 '22 01:11

shruti