DTpicker update
This commit is contained in:
parent
5afe2df78c
commit
9e37b9f0ae
1 changed files with 13 additions and 12 deletions
17
shared/static/vendor/datetimepicker/picker.js
vendored
17
shared/static/vendor/datetimepicker/picker.js
vendored
|
@ -39,6 +39,7 @@ class DateTimePicker {
|
|||
this.target.addEventListener('click', () => {
|
||||
document.documentElement.classList.add('is-clipped');
|
||||
this.modal.classList.add('is-active');
|
||||
this.target.blur();
|
||||
});
|
||||
|
||||
if (!['fr', 'en'].includes(config.lang)) {
|
||||
|
@ -86,6 +87,7 @@ class DateTimePicker {
|
|||
} else {
|
||||
this._beginning.setMonth(this._beginning.getMonth() - 1, 1);
|
||||
}
|
||||
break;
|
||||
case 'months':
|
||||
this._beginning.setFullYear(this._beginning.getFullYear() - 1);
|
||||
break;
|
||||
|
@ -94,11 +96,10 @@ class DateTimePicker {
|
|||
});
|
||||
|
||||
this._menu.addEventListener('click', () => {
|
||||
let _index = DateTimePicker.views.indexOf(this._view);
|
||||
_index = Math.min(2, _index + 1);
|
||||
this._view = DateTimePicker.views[_index];
|
||||
if (this._view == 'days') {
|
||||
this._view = 'months';
|
||||
this.refreshView();
|
||||
console.log(this._view, _index);
|
||||
}
|
||||
});
|
||||
|
||||
let _selects = this.modal.querySelectorAll('footer select');
|
||||
|
@ -147,11 +148,11 @@ class DateTimePicker {
|
|||
|
||||
// Création du tableau
|
||||
const _dayLength = 86400000;
|
||||
var day = new Date(_beginning.getTime() - _dayLength * ((_beginning.getDay() + 6) % 7));
|
||||
let day = new Date(_beginning.getTime() - _dayLength * ((_beginning.getDay() + 6) % 7));
|
||||
|
||||
const _tbody = _body.querySelector('tbody');
|
||||
for (let i = 0; i < 6; i++) {
|
||||
if (i == 0 || day.getMonth() <= _beginning.getMonth()) {
|
||||
if (i == 0 || (day.getMonth() <= _beginning.getMonth()) && day.getFullYear() <= _beginning.getFullYear()) {
|
||||
let row = document.createElement('tr');
|
||||
for (let j = 0; j < 7; j++) {
|
||||
let cell = document.createElement('td');
|
||||
|
@ -197,7 +198,7 @@ class DateTimePicker {
|
|||
const months = _months[this.config.lang];
|
||||
|
||||
this._menu.innerHTML = `<b>${_beginning.getFullYear()}</b>`;
|
||||
var _body = this.modal.querySelector('.modal-card section .column');
|
||||
let _body = this.modal.querySelector('.modal-card section .column');
|
||||
_body.innerHTML = `<table class="table"><tbody></tbody></table>`;
|
||||
|
||||
const _tbody = _body.querySelector('tbody');
|
||||
|
@ -259,7 +260,7 @@ class DateTimePicker {
|
|||
}
|
||||
|
||||
static dateValue(value) {
|
||||
let _real = new Date(value.getTime() - 60000 * value.getTimezoneOffset());
|
||||
const _real = new Date(value.getTime() - 60000 * value.getTimezoneOffset());
|
||||
return _real.toISOString().replace('T', ' ').replace(/:\d{2}\.\d{3}Z/, '');
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue