Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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>
like image 435
sil-her Avatar asked Jun 14 '16 09:06

sil-her


1 Answers

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.

like image 153
Kuldeep Vithlani Avatar answered Nov 12 '22 06:11

Kuldeep Vithlani