Skip to content

add more checks for the date selection #4

@rkmd0

Description

@rkmd0

e.g. add a warning if the date is in the past or the user selected sunday as a starting date (since for internationals the sunday regulation is unusual)
i was thinking about something like this but i think i would prefer having a yellow box for warnings, if possible:

  const selectedDate = new Date(document.getElementById("date").value);
  const today = new Date();

  if (selectedDate<today) {
    const toastTrigger = document.getElementById('startRouting');
    const toastLiveExample = document.getElementById('liveToast');

    if (toastTrigger) {
      const toastBootstrap = bootstrap.Toast.getOrCreateInstance(toastLiveExample);
      const errmsg = document.getElementById('errmsg');
      errmsg.textContent = "You cant select a day thats in the past";
      toastBootstrap.show();
    }
    return -1;
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions