diff --git a/frontend/static/js/library.js b/frontend/static/js/library.js index b4429cc..01bb3d3 100644 --- a/frontend/static/js/library.js +++ b/frontend/static/js/library.js @@ -35,17 +35,6 @@ function getSorting(type, key=false) { return getLocalStorage(sorting_key)[sorting_key]; }; -function getWeekDays(locale) { - const baseDate = new Date(Date.UTC(2017, 0, 2)); // just a Monday - const weekDays = []; - for (i = 0; i < 7; i++) - { - weekDays.push(baseDate.toLocaleDateString(locale, { weekday: 'short' })); - baseDate.setDate(baseDate.getDate() + 1); - } - return weekDays; -}; - function getActiveTab() { for (let t of Object.values(Types)) { if (getComputedStyle(t).display === 'flex') @@ -159,7 +148,7 @@ function evaluateSizing() { Object.values(Types).forEach(t => fillLibrary(t)); setInterval(() => fillLibrary(Types.reminder), 60000); -const week_days = getWeekDays(getLocalStorage('locale')['locale']); +const week_days = ["Mo", "Tu", "We", "Thu", "Fr", "Sa", "Su"]; NavButtons.home.onclick = e => showWindow("home"); NavButtons.notification_services.onclick = e => showWindow("notification"); diff --git a/frontend/static/js/notification.js b/frontend/static/js/notification.js index 8c28b96..1f28172 100644 --- a/frontend/static/js/notification.js +++ b/frontend/static/js/notification.js @@ -545,11 +545,15 @@ function testService() { const faulty_inputs = [...NotiEls.add_service_window.querySelectorAll('input:not([data-regex=""])[data-regex]')] - .filter(el => !new RegExp - ( - el.dataset.regex.split(',').slice(0, el.dataset.regex.split(',').length-1).join(','), - el.dataset.regex.split(',')[el.dataset.regex.split(',').length-1] - ).test(el.value) + .filter(el => + !( + (!el.required && el.value === '') + || + new RegExp( + el.dataset.regex.split(',').slice(0, el.dataset.regex.split(',').length-1).join(','), + el.dataset.regex.split(',')[el.dataset.regex.split(',').length-1] + ).test(el.value) + ) ); if (faulty_inputs.length > 0) { faulty_inputs.forEach(el => el.classList.add('error-input'));