Terminplaner: Zellen nur unter der Ressourcensperre freigeben, gemeinsame Hilfsfunktionen
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e281db1b2b
commit
9ad8515d60
6 files changed
+284
-71
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import { istFeiertag } from './feiertage.js'
|
||||
import { pruefeNow, zeitMs } from './util.js'
|
||||
import { heute, monatInfo, plusTage, wochentag, zuUtc } from './zeit.js'
|
||||
|
||||
/**
|
||||
@@ -22,18 +23,6 @@ const NICHT_BELEGT = new Set(['abgesagt', 'abgelehnt', 'verfallen'])
|
||||
const pad = (n) => String(n).padStart(2, '0')
|
||||
const hhmm = (min) => `${pad(Math.floor(min / 60))}:${pad(min % 60)}`
|
||||
|
||||
function pruefeNow(now, name) {
|
||||
if (!(now instanceof Date) || Number.isNaN(now.getTime())) throw new TypeError(`${name}: now fehlt`)
|
||||
}
|
||||
|
||||
/** Zeitpunkt als ms: Date, ISO-String (auch mit +00:00) oder Zahl; sonst NaN. */
|
||||
function zeitMs(wert) {
|
||||
if (wert instanceof Date) return wert.getTime()
|
||||
if (typeof wert === 'string' && wert !== '') return new Date(wert).getTime()
|
||||
if (typeof wert === 'number') return wert
|
||||
return Number.NaN
|
||||
}
|
||||
|
||||
/** 'HH:MM' -> Minuten seit Mitternacht ('24:00' = 1440), sonst null. */
|
||||
function minuten(wert) {
|
||||
const m = typeof wert === 'string' ? /^(\d{2}):(\d{2})$/.exec(wert) : null
|
||||
|
||||
Reference in new issue
Block a user