// Shared pure helpers and constants used across modules. // Allowed range for the "moderators per day" setting. export const MIN_MODERATORS_PER_DAY = 1; export const MAX_MODERATORS_PER_DAY = 5; // "YYYY-MM-DD" from numeric parts. export function toISO(year, month, day) { return year + '-' + String(month).padStart(2, '0') + '-' + String(day).padStart(2, '0'); } // "YYYY-MM" month prefix (used to filter history by month). export function monthPrefix(year, month) { return year + '-' + String(month).padStart(2, '0'); } // Weekday for an ISO date string: 1=Mo, 2=Di, 3=Mi, 4=Do, 5=Fr, 6=Sa, 7=So. export function getWeekday(isoDate) { const d = new Date(isoDate + 'T12:00:00Z').getUTCDay(); // 0=Sun return d === 0 ? 7 : d; } // "DD.MM.YYYY" from an ISO date string. export function formatDateDE(isoDate) { const [y, m, d] = isoDate.split('-'); return d + '.' + m + '.' + y; } // { [id]: name } lookup map from an employees array. export function buildNameMap(employees) { return Object.fromEntries(employees.map(e => [e.id, e.name])); }