From b7f689afa02c53aca4ed39a83297cbbc0ccb4eaf Mon Sep 17 00:00:00 2001 From: CasVT Date: Thu, 19 Jan 2023 22:40:48 +0100 Subject: [PATCH] Added error message for time set to past --- frontend/static/js/add.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frontend/static/js/add.js b/frontend/static/js/add.js index e400f9c..09b5299 100644 --- a/frontend/static/js/add.js +++ b/frontend/static/js/add.js @@ -15,6 +15,9 @@ const type_buttons = { }; function addReminder() { + inputs.time.classList.remove('error-input'); + inputs.time.removeAttribute('title'); + const data = { 'title': inputs.title.value, 'time': new Date(inputs.time.value).getTime() / 1000, @@ -44,6 +47,9 @@ function addReminder() { .catch(e => { if (e === 401) { window.location.href = '/'; + } else if (e === 400) { + inputs.time.classList.add('error-input'); + inputs.time.title = 'Time is in the past'; } else { console.log(e); };