Show read-only server reading hours in settings

This commit is contained in:
Codex committed 2026-10-14 22:42:54 +02:00
1 parent de8e7ed988
commit ddd9c62c40
9 files changed
+89 -7

No files matched your search

+6 -1
View File
@@ -44,6 +44,11 @@ function scheduled(schedule, date = new Date()) {
schedule.days[(day + 6) % 7].some(({ start, end }) => end < start && now < end);
}
function publicSchedule(schedule) {
return { enabled: !!schedule, timezone: schedule?.timezone || null,
days: schedule ? schedule.days.map(ranges => ranges.map(({ label }) => [...label])) : [] };
}
function normalizeAnswer(value) {
return String(value || '').normalize('NFKD').replace(/[\u0300-\u036f]/g, '').toLowerCase()
.replace(/[^a-z0-9]+/g, ' ').trim().replace(/\s+/g, ' ');
@@ -136,4 +141,4 @@ function createReadingAccess({ schedule, bank = {}, unlockMinutes = 60, grants,
};
}
module.exports = { parseSchedule, scheduled, normalizeAnswer, answerMatches, loadQuestionBank, createReadingAccess };
module.exports = { parseSchedule, scheduled, publicSchedule, normalizeAnswer, answerMatches, loadQuestionBank, createReadingAccess };