diff --git a/helpers/utils.js b/helpers/utils.js index e810c17..b768f64 100644 --- a/helpers/utils.js +++ b/helpers/utils.js @@ -134,7 +134,7 @@ function getWeekStart(dateStr) { // Helper: Dezimalstunden in Anzeige "X h Y min" (z. B. 8.25 -> "8 h 15 min", -1.5 -> "-1 h 30 min") function formatHoursMin(decimalHours) { - if (decimalHours == null || !Number.isFinite(Number(decimalHours))) return '0 h 0 min'; + if (decimalHours == null || !Number.isFinite(Number(decimalHours))) return '0h 0min'; const n = Number(decimalHours); const sign = n < 0 ? -1 : 1; const absVal = Math.abs(n); @@ -145,7 +145,7 @@ function formatHoursMin(decimalHours) { min = 0; } const prefix = sign < 0 ? '-' : ''; - return prefix + h + ' h ' + min + ' min'; + return prefix + h + 'h ' + min + 'min'; } module.exports = { diff --git a/public/js/format-hours.js b/public/js/format-hours.js index 379c4b0..31d73b9 100644 --- a/public/js/format-hours.js +++ b/public/js/format-hours.js @@ -2,7 +2,7 @@ // Wird global als window.formatHoursMin bereitgestellt. (function () { function formatHoursMin(decimalHours) { - if (decimalHours == null || !Number.isFinite(Number(decimalHours))) return '0 h 0 min'; + if (decimalHours == null || !Number.isFinite(Number(decimalHours))) return '0h 0min'; var n = Number(decimalHours); var sign = n < 0 ? -1 : 1; var absVal = Math.abs(n); @@ -13,7 +13,7 @@ min = 0; } var prefix = sign < 0 ? '-' : ''; - return prefix + h + ' h ' + min + ' min'; + return prefix + h + 'h ' + min + 'min'; } window.formatHoursMin = formatHoursMin; })(); diff --git a/services/pdf-service.js b/services/pdf-service.js index de25956..165fd3e 100644 --- a/services/pdf-service.js +++ b/services/pdf-service.js @@ -190,7 +190,7 @@ function generatePDF(timesheetId, req, res) { // Feiertag am Wochenende: keine Tagesarbeitsstunden anzeigen const holidayDay = new Date(row.date + 'T12:00:00').getDay(); const isWeekendHoliday = (holidayDay === 0 || holidayDay === 6); - const holidayHoursStr = isWeekendHoliday ? '0 h 0 min (Feiertag)' : formatHoursMin(fullDayHours) + ' (Feiertag)'; + const holidayHoursStr = isWeekendHoliday ? '0h 0min (Feiertag)' : formatHoursMin(fullDayHours) + ' (Feiertag)'; const rowData = [formatDate(row.date), '-', '-', '-', holidayHoursStr]; rowData.forEach((data, i) => { doc.text(data, x, y, { width: colWidths[i], align: 'left' }); @@ -462,7 +462,7 @@ function generatePDFToBuffer(timesheetId, req) { // Feiertag am Wochenende: keine Tagesarbeitsstunden anzeigen const holidayDay = new Date(row.date + 'T12:00:00').getDay(); const isWeekendHoliday = (holidayDay === 0 || holidayDay === 6); - const holidayHoursStr = isWeekendHoliday ? '0 h 0 min (Feiertag)' : formatHoursMin(fullDayHoursBuf) + ' (Feiertag)'; + const holidayHoursStr = isWeekendHoliday ? '0h 0min (Feiertag)' : formatHoursMin(fullDayHoursBuf) + ' (Feiertag)'; const rowDataBuf = [formatDate(row.date), '-', '-', '-', holidayHoursStr]; rowDataBuf.forEach((data, i) => { doc.text(data, x, y, { width: colWidths[i], align: 'left' }); diff --git a/views/dashboard.ejs b/views/dashboard.ejs index a2d51d0..3261351 100644 --- a/views/dashboard.ejs +++ b/views/dashboard.ejs @@ -52,11 +52,11 @@
Gesamtstunden diese Woche: - 0 h 0 min + 0h 0min
diff --git a/views/verwaltung.ejs b/views/verwaltung.ejs index ba074cb..8790ca2 100644 --- a/views/verwaltung.ejs +++ b/views/verwaltung.ejs @@ -91,7 +91,7 @@
- Aktuelle Überstunden: - Stunden + Aktuelle Überstunden: -
Verbleibender Urlaub: - Tage @@ -434,7 +434,7 @@ el.textContent = '-'; el.style.color = ''; } else { - el.textContent = value >= 0 ? '+' + value.toFixed(2) : value.toFixed(2); + el.textContent = (value >= 0 ? '+' : '') + formatHoursMin(value); el.style.color = value >= 0 ? '#27ae60' : '#e74c3c'; } });