Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

              
                <md-content id="content" layout="column" flex ng-app="app" ng-controller="MainCtrl as ctrl">
  <md-toolbar class="md-whiteframe-z2">
    <div style="text-align: center;">
      <h1>mdPickers</h1>
      <h2>Material Design date/time pickers</h2>
    </div>
  </md-toolbar>
  
  <md-content flex layout="column" layout-align="center center" layout-padding>
    <h3><a href="https://github.com/alenaksu/mdPickers">https://github.com/alenaksu/mdPickers</a></h3>
    
    <div layout="row" ng-form="demoForm">
          <div layout-padding>
            <h2>Date picker</h2>
            <div>
              <h4 class="md-subhead">Standard date picker</h4>
              <mdp-date-picker mdp-placeholder="Date" ng-model="currentDate"></mdp-date-picker>
            </div>
            <div>
              <h4 class="md-subhead">Disabled date picker</h4>
              <mdp-date-picker mdp-placeholder="Date" mdp-disabled="true" ng-model="currentDate"></mdp-date-picker>
            </div>
            <div>
              <h4 class="md-subhead">Custom format + error messages</h4>
              <mdp-date-picker mdp-open-on-click required name="dateFormat" mdp-placeholder="My date(dd/mm/yyyy)" mdp-format="DD/MM/YYYY" ng-model="currentDate">
                <div ng-messages="demoForm.dateFormat.$error">
                  <div ng-message="required">This is required</div>
                  <div ng-message="format">Invalid format</div>
                </div>
              </mdp-date-picker>
            </div>
            <div>
              <h4 class="md-subhead">Min/max date</h4>
              <mdp-date-picker name="minMaxDate" mdp-placeholder="Date" mdp-min-date="'2000-01-01'" mdp-max-date="'2005-01-01'" ng-model="currentDate">
                <div ng-messages="demoForm.minMaxDate.$error">
                  <div ng-message="required">This is required</div>
                  <div ng-message="format">Invalid format</div>
                  <div ng-message="minDate">Min date</div>
                  <div ng-message="maxDate">Max date</div>
                </div>
              </mdp-date-picker>
            </div>
            <div>
              <h4 class="md-subhead">Filtering date</h4>
              <mdp-date-picker mdp-placeholder="Date" mdp-date-filter="ctrl.filterDate" ng-model="currentDateMinMax"></mdp-date-picker>
            </div>
            <div>
              <h4 class="md-subhead">Using $mdpDatePicker service</h4>
              <md-button class="md-raised md-warn" ng-click="ctrl.showDatePicker($event)" aria-label="show picker">show picker</md-button>
              <p>
                {{ currentDate | date:'shortDate' }}
              </p>
            </div>
          </div>
          <div layout-padding>
            <h2>Time picker</h2>
            <div>
              <h4 class="md-subhead">Standard time picker</h4>
              
              <mdp-time-picker ng-model="currentDate"></mdp-time-picker>
            </div>
            
            <div>
              <h4 class="md-subhead">Disabled time picker</h4>
              <mdp-time-picker mdp-disabled="true" ng-model="currentDate"></mdp-time-picker>
            </div>
            
            <div>
              <h4 class="md-subhead">Auto switch between hours and minutes</h4>
              
              <mdp-time-picker mdp-auto-switch="true" ng-model="currentTime"></mdp-time-picker>
            </div>
    
            <div>
              <h4 class="md-subhead">Custom format + error messages</h4>
              <mdp-time-picker name="timeFormat" ng-model="currentTimeText" mdp-format="HH:mm A">
                <div ng-messages="demoForm.timeFormat.$error">
                  <div ng-message="required">This is required</div>
                  <div ng-message="format">Invalid format</div>
                </div>
              </mdp-time-picker>
            </div>
            
            <input type="time" ng-model="test" mdp-time-picker />
    
            <div>
              <h4 class="md-subhead">Using $mdpTimePicker service</h4>
              <md-button class="md-raised md-warn" ng-click="ctrl.showTimePicker($event)" aria-label="show picker">show picker</md-button>
              <p>
                {{ currentTime | date:'HH:mm' }}
              </p>
            </div>
          </div>
        </div>
  </md-content>
</md-content>
              
            
!

CSS

              
                body {
  font-family: 'Roboto', sans-serif;
}

#content { height: 100%; }

#content > md-content {
  background-color: #eee; 
}

              
            
!

JS

              
                (function() {
	var module = angular.module("app", [
    "ngMaterial",
    "ngAnimate",
    "ngAria",
    "ngMessages",
    "mdPickers"
  ]); 
  
  module.controller("MainCtrl", ['$scope', '$mdpDatePicker', '$mdpTimePicker', function($scope, $mdpDatePicker, $mdpTimePicker){
    $scope.currentDate = new Date();
  	this.showDatePicker = function(ev) {
    	$mdpDatePicker($scope.currentDate, {
        targetEvent: ev
      }).then(function(selectedDate) {
        $scope.currentDate = selectedDate;
      });;
    };
    
    this.filterDate = function(date) {
      return moment(date).date() % 2 == 0;
    };
    
    this.showTimePicker = function(ev) {
    	$mdpTimePicker($scope.currentTime, {
        targetEvent: ev
      }).then(function(selectedDate) {
        $scope.currentTime = selectedDate;
      });;
    }  
  }]);
})();
              
            
!
999px

Console