Lint
This commit is contained in:
parent
5d2b06be09
commit
9fa734b100
|
@ -1,39 +1,37 @@
|
||||||
import "../css/app.css";
|
import '../css/app.css';
|
||||||
import Alpine from "alpinejs";
|
import Alpine from 'alpinejs';
|
||||||
import Datepicker from "flowbite-datepicker/Datepicker";
|
import Datepicker from 'flowbite-datepicker/Datepicker';
|
||||||
import de from "../../node_modules/flowbite-datepicker/js/i18n/locales/de.js";
|
import de from '../../node_modules/flowbite-datepicker/js/i18n/locales/de.js';
|
||||||
Datepicker.locales.de = de.de;
|
Datepicker.locales.de = de.de;
|
||||||
import dayjs from "dayjs";
|
import dayjs from 'dayjs';
|
||||||
import customParseFormat from "dayjs/plugin/customParseFormat";
|
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
||||||
dayjs.extend(customParseFormat);
|
dayjs.extend(customParseFormat);
|
||||||
|
|
||||||
function initDatepicker(el) {
|
function initDatepicker(el) {
|
||||||
new Datepicker(el, {
|
new Datepicker(el, {
|
||||||
autohide: true,
|
autohide: true,
|
||||||
format: "dd.mm.yyyy",
|
format: 'dd.mm.yyyy',
|
||||||
language: "de",
|
language: 'de',
|
||||||
update: true,
|
update: true,
|
||||||
});
|
});
|
||||||
el.addEventListener("changeDate", function (event) {
|
el.addEventListener('changeDate', function (event) {
|
||||||
event.target.dispatchEvent(new Event("input"));
|
event.target.dispatchEvent(new Event('input'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
document.querySelectorAll("[datepicker]").forEach((el) => initDatepicker(el));
|
document.querySelectorAll('[datepicker]').forEach((el) => initDatepicker(el));
|
||||||
|
|
||||||
window.Alpine = Alpine;
|
window.Alpine = Alpine;
|
||||||
Alpine.data("form", () => ({
|
Alpine.data('form', () => ({
|
||||||
birthday: null,
|
birthday: null,
|
||||||
date: null,
|
date: null,
|
||||||
isUnder18: function () {
|
isUnder18: function () {
|
||||||
if (!this.birthday || !this.date) {
|
if (!this.birthday || !this.date) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return dayjs(this.birthday, "DD.MM.YYYY")
|
return dayjs(this.birthday, 'DD.MM.YYYY').add(18, 'year').isAfter(dayjs(this.date, 'DD.MM.YYYY'));
|
||||||
.add(18, "year")
|
},
|
||||||
.isAfter(dayjs(this.date, "DD.MM.YYYY"));
|
|
||||||
},
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Alpine.start();
|
Alpine.start();
|
||||||
|
|
Loading…
Reference in New Issue