Sha256: 47eda5bc1bdf0d1c10d95dcabb1a58a041cf9fc6ea2ef4af337e754b18225bec

Contents?: true

Size: 1.63 KB

Versions: 8

Compression:

Stored size: 1.63 KB

Contents

angular.module('ui.bootstrap.demo').controller('DatepickerDemoCtrl', function ($scope) {
  $scope.today = function() {
    $scope.dt = new Date();
  };
  $scope.today();

  $scope.clear = function () {
    $scope.dt = null;
  };

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

  $scope.toggleMin = function() {
    $scope.minDate = $scope.minDate ? null : new Date();
  };
  $scope.toggleMin();
  $scope.maxDate = new Date(2020, 5, 22);

  $scope.open = function($event) {
    $scope.status.opened = true;
  };

  $scope.setDate = function(year, month, day) {
    $scope.dt = new Date(year, month, day);
  };

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

  $scope.formats = ['dd-MMMM-yyyy', 'yyyy/MM/dd', 'dd.MM.yyyy', 'shortDate'];
  $scope.format = $scope.formats[0];

  $scope.status = {
    opened: false
  };

  var tomorrow = new Date();
  tomorrow.setDate(tomorrow.getDate() + 1);
  var afterTomorrow = new Date();
  afterTomorrow.setDate(tomorrow.getDate() + 2);
  $scope.events =
    [
      {
        date: tomorrow,
        status: 'full'
      },
      {
        date: afterTomorrow,
        status: 'partially'
      }
    ];

  $scope.getDayClass = function(date, mode) {
    if (mode === 'day') {
      var dayToCheck = new Date(date).setHours(0,0,0,0);

      for (var i=0;i<$scope.events.length;i++){
        var currentDay = new Date($scope.events[i].date).setHours(0,0,0,0);

        if (dayToCheck === currentDay) {
          return $scope.events[i].status;
        }
      }
    }

    return '';
  };
});

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
active_record_survey_api-0.0.19 spec/test_app/vendor/assets/bower_components/angular-ui-bootstrap/src/datepicker/docs/demo.js
active_record_survey_api-0.0.18 spec/test_app/vendor/assets/bower_components/angular-ui-bootstrap/src/datepicker/docs/demo.js
active_record_survey_api-0.0.17 spec/test_app/vendor/assets/bower_components/angular-ui-bootstrap/src/datepicker/docs/demo.js
active_record_survey_api-0.0.14 spec/test_app/vendor/assets/bower_components/angular-ui-bootstrap/src/datepicker/docs/demo.js
active_record_survey_api-0.0.12 spec/test_app/vendor/assets/bower_components/angular-ui-bootstrap/src/datepicker/docs/demo.js
active_record_survey_api-0.0.11 spec/test_app/vendor/assets/bower_components/angular-ui-bootstrap/src/datepicker/docs/demo.js
active_record_survey_api-0.0.7 spec/test_app/vendor/assets/bower_components/angular-ui-bootstrap/src/datepicker/docs/demo.js
active_record_survey_api-0.0.6 spec/test_app/vendor/assets/bower_components/angular-ui-bootstrap/src/datepicker/docs/demo.js