let dateOptions = {month: 'short', year: 'numeric'};
document.addEventListener('DOMContentLoaded', () =>
{
// check if the user is logged in, if not redirect to log in
/* fetch('/api/user/isLoggedIn').then(res =>
{
if (!res.ok)
{
window.location.href = './';
}
});*/
document.querySelector("#dateFrom").max = new Date().toISOString().split("T")[0];
fetch("/api/timelineData/edu").then(res =>
{
res.json().then(json =>
{
if (res.ok)
{
for (let i = 0; i < json.length; i++)
{
let timelineItem = document.createElement("form")
timelineItem.id = "timelineItem" + i;
timelineItem.classList.add("timelineItem");
timelineItem.onsubmit = e => updateItem(i, e);
timelineItem.innerHTML = `