Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Min max #158

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node_modules
.sass-cache
.vscode
/coverage
.idea/
8 changes: 7 additions & 1 deletion demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,13 @@

<script>

var picker = new MaterialDatetimePicker({})
var START_OF_YEAR = moment().startOf('year').toDate();
var END_OF_YEAR = moment().endOf('year').toDate();

var picker = new MaterialDatetimePicker({
minDate: START_OF_YEAR,
maxDate: END_OF_YEAR
})
.on('submit', function(d) {
output.innerText = d;
});
Expand Down
6 changes: 3 additions & 3 deletions dist/material-datetime-picker.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
border: 0;
width: 300px;
text-align: center;
-webkit-tap-highlight-color: transparent;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
box-shadow: 0 14px 45px rgba(0, 0, 0, 0.25), 0 10px 18px rgba(0, 0, 0, 0.22);
border-radius: 2px;
opacity: 0;
Expand Down Expand Up @@ -169,7 +169,7 @@
height: 36px; }

.c-datepicker__day-head, c-datepicker__day-body {
-webkit-tap-highlight-color: transparent; }
-webkit-tap-highlight-color: rgba(0, 0, 0, 0); }

.modal-btns {
float: right; }
Expand Down Expand Up @@ -427,7 +427,7 @@
height: 0%;
border-radius: 50%;
transform: translate(-50%, -50%);
transition: width 100ms ease-in-out, height 100ms ease-in-out; }
transition: width 100ms ease-in-out, height 100ms ease-in-out; }
.u-hover-ball-effect:hover, .c-datepicker__day-body:hover, .c-datepicker__clock__num:hover, .c-datepicker__clock__am-pm-toggle label:hover {
color: white; }
.u-hover-ball-effect:hover:before, .c-datepicker__day-body:hover:before, .c-datepicker__clock__num:hover:before, .c-datepicker__clock__am-pm-toggle label:hover:before {
Expand Down
12 changes: 8 additions & 4 deletions dist/material-datetime-picker.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/material-datetime-picker.js.map

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions dist/material-datetime-picker.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,9 @@ var defaults$$1 = function defaults$$1() {
// the container to append the picker
container: document.body,
// allow any dates
dateValidator: undefined
dateValidator: undefined,
minDate: null,
maxDate: null
};
};

Expand Down Expand Up @@ -288,7 +290,9 @@ var DateTimePicker = function (_Events) {
styles: this.options.styles,
time: false,
dateValidator: validator,
initialValue: this.value
initialValue: this.value,
min: this.options.minDate,
max: this.options.maxDate
}).on('data', onData);
}

Expand Down Expand Up @@ -371,12 +375,12 @@ var DateTimePicker = function (_Events) {
}
};

window.addEventListener("keydown", this._onWindowKeypress);
window.addEventListener('keydown', this._onWindowKeypress);
}
}, {
key: '_stopListeningForCloseEvents',
value: function _stopListeningForCloseEvents() {
window.removeEventListener("keydown", this._onWindowKeypress);
window.removeEventListener('keydown', this._onWindowKeypress);
this._closeHandler = null;
}
}, {
Expand Down
2 changes: 1 addition & 1 deletion dist/material-datetime-picker.mjs.map

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions lib/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ const defaults = () => ({
// the container to append the picker
container: document.body,
// allow any dates
dateValidator: undefined
dateValidator: undefined,
minDate: null,
maxDate: null
});

class DateTimePicker extends Events {
Expand Down Expand Up @@ -72,7 +74,9 @@ class DateTimePicker extends Events {
styles: this.options.styles,
time: false,
dateValidator: validator,
initialValue: this.value
initialValue: this.value,
min: this.options.minDate,
max: this.options.maxDate
}).on('data', onData);
}

Expand Down
Loading