sil-her
sil-her

Reputation: 75

Datepicker Angularjs startWeek on Monday

I've a problem with angular md-datepicker. It's start by default on Sunday, but I need to start on Monday.

I've been tried to add an option to the controller, but it doesn't work. Anyone can help me please?

This is the code:

 $scope.dateOptions = {
  formatYear: 'yy',
  showWeeks: false,      
  firstDayOfWeek  : 1
};
<md-datepicker ng-model="desdeDate" md-placeholder="Enter date" options="dateOptions"></md-datepicker>

Upvotes: 7

Views: 3462

Answers (1)

Kuldeep Vithlani
Kuldeep Vithlani

Reputation: 613

Use following code to configure first day of week in md-date

 angular.module('MyApp').controller('AppCtrl', function($scope) {
  $scope.myDate = new Date();


}).config(function($mdDateLocaleProvider) {

  // Can change week display to start on Monday.
  $mdDateLocaleProvider.firstDayOfWeek = 1;
  // Optional.

  });

Below is link for working example.

Link for example

You need to change start day of week using $mdDateLocaleProvider.

Upvotes: 12

Related Questions