diff --git a/demo/index.html b/demo/index.html index c19103d..eeebbe4 100644 --- a/demo/index.html +++ b/demo/index.html @@ -21,6 +21,7 @@ + @@ -38,6 +39,8 @@ scope.setLocale = function(e) { scope.locale = e.detail.item.label; } + scope.minDate = moment().startOf('day'); + scope.maxDate = moment().add(7, 'days').endOf('day'); diff --git a/paper-date-picker-behaviors.html b/paper-date-picker-behaviors.html index c64c58c..201abb2 100644 --- a/paper-date-picker-behaviors.html +++ b/paper-date-picker-behaviors.html @@ -73,7 +73,17 @@ value: function() { return moment.locale(); } - } + }, + + /** + * The minimum allowed date + */ + minDate: Date, + + /** + * The maximum allowed date + */ + maxDate: Date }, _edit: function(dialogId) { @@ -88,9 +98,11 @@ // Localize text dialog.cancelButton = this.cancelButton; dialog.okButton = this.okButton; - dialog.locale = this.locale; + dialog.minDate = this.minDate; + dialog.maxDate = this.maxDate; + // Capture date if the user saved the dialog dialog.addEventListener('paper-date-picker-edit-dialog-save', function(e) { this._changeDate(e.detail); diff --git a/paper-date-picker-edit-dialog.html b/paper-date-picker-edit-dialog.html index 703766d..39c3d39 100644 --- a/paper-date-picker-edit-dialog.html +++ b/paper-date-picker-edit-dialog.html @@ -13,7 +13,7 @@ - +
[[cancelButton]] [[okButton]] @@ -55,6 +55,16 @@ * Locale used for formatting dates */ locale: String, + + /** + * The minimum allowed date + */ + minDate: Date, + + /** + * The maximum allowed date + */ + maxDate: Date }, /** diff --git a/paper-datetime-picker-item.html b/paper-datetime-picker-item.html index 3a5a5a3..76f0e16 100644 --- a/paper-datetime-picker-item.html +++ b/paper-datetime-picker-item.html @@ -108,9 +108,11 @@ // Localize text dialog.cancelButton = this.cancelButton; dialog.okButton = this.okButton; - dialog.locale = this.locale; + dialog.minDate = this.minDate; + dialog.maxDate = this.maxDate; + // Capture date if the user saved the dialog dialog.addEventListener('paper-date-picker-edit-dialog-save', function(e) { var newDate = e.detail;