Calendar V3

This commit is contained in:
2026-03-11 13:15:20 +01:00
parent a4815fc672
commit 94215fdd65
13 changed files with 190 additions and 61 deletions

View File

@@ -66,12 +66,12 @@
html += '<div class="luxtools-event-popup-field">';
if (allDay) {
html += '<strong>Date:</strong> ' + formatDate(start);
if (end) {
if (end && !isSameMoment(start, end)) {
html += ' &ndash; ' + formatDate(end);
}
} else {
html += '<strong>Time:</strong> ' + formatDateTime(start);
if (end) {
if (end && !isSameMoment(start, end)) {
html += ' &ndash; ' + formatDateTime(end);
}
}
@@ -114,14 +114,23 @@
if (!isoStr) return '';
var d = new Date(isoStr);
if (isNaN(d.getTime())) return isoStr;
return d.toLocaleDateString();
return pad2(d.getDate()) + '.' + pad2(d.getMonth() + 1) + '.' + d.getFullYear();
}
function formatDateTime(isoStr) {
if (!isoStr) return '';
var d = new Date(isoStr);
if (isNaN(d.getTime())) return isoStr;
return d.toLocaleDateString() + ' ' + d.toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit' });
return formatDate(isoStr) + ' ' + pad2(d.getHours()) + ':' + pad2(d.getMinutes());
}
function isSameMoment(left, right) {
if (!left || !right) return false;
return left === right;
}
function pad2(value) {
return String(value).padStart(2, '0');
}
function escapeHtml(text) {
@@ -198,11 +207,9 @@
// Visual feedback: mark item as done or revert
if (action === 'complete') {
item.classList.add('luxtools-task-completed');
// Fade out and remove after a short delay
item.style.opacity = '0.5';
setTimeout(function () {
item.style.display = 'none';
}, 1000);
button.textContent = 'Reopen';
button.setAttribute('data-action', 'reopen');
button.disabled = false;
} else {
item.classList.remove('luxtools-task-completed');
item.style.opacity = '1';

View File

@@ -86,9 +86,10 @@
var formatter;
try {
formatter = new Intl.DateTimeFormat(undefined, {
formatter = new Intl.DateTimeFormat('de-DE', {
hour: '2-digit',
minute: '2-digit'
minute: '2-digit',
hour12: false
});
} catch (e) {
formatter = null;