diff --git a/backend/controllers/events.js b/backend/controllers/events.js index 4eb06e4..025042b 100644 --- a/backend/controllers/events.js +++ b/backend/controllers/events.js @@ -23,7 +23,7 @@ exports.getEvent = async function (req, res, next) { exports.getEvents = async function (req, res, next) { try { - let events = await Event.find({},["title", "description", "startTime", "endTime", "expireTime", "numCalls", "createdAt"]).exec(); + let events = await Event.find({},["title", "description", "startTime", "endTime", "expireTime", "numCalls", "createdAt", "shortNames"]).exec(); res.contentType('json'); res.send(JSON.stringify(events)); } diff --git a/frontend/src/Event/ListEvents.js b/frontend/src/Event/ListEvents.js index 1a84377..b434ea6 100644 --- a/frontend/src/Event/ListEvents.js +++ b/frontend/src/Event/ListEvents.js @@ -1,5 +1,5 @@ import React, { Component } from "react"; -import { Link, useNavigate } from 'react-router-dom' +import { Link, useNavigate } from 'react-router-dom' import { Container, @@ -10,55 +10,55 @@ import { Divider, Table } from "semantic-ui-react"; -import NavBar from "../Common/NavBar" +import NavBar from "../Common/NavBar" import { useGetEventsQuery } from "../features/api/apiSlice"; // ---------------------------------------------------- const ListEvents = (props) => { - const dateRange = (start, end) => { - if (start.getYear() != end.getYear()) { - return start.toLocaleDateString('en-us', { weekday:"short", year:"numeric", month:"short", day:"numeric"}) + " " + start.toLocaleTimeString() + " - " + end.toLocaleDateString('en-us', { weekday:"short", year:"numeric", month:"short", day:"numeric"}) + " " + end.toLocaleTimeString(); - } else if (start.getMonth() != end.getMonth()) { - return start.toLocaleDateString('en-us', { weekday:"short", month:"short", day:"numeric"}) + " " + start.toLocaleTimeString() + " - " + end.toLocaleDateString('en-us', { weekday:"short", month:"short", day:"numeric"}) + " " + end.toLocaleTimeString(); - - } else if (start.getDay() != end.getDay()) { - return start.toLocaleDateString('en-us', { weekday:"short", month:"short", day:"numeric"}) + " " + start.toLocaleTimeString() + " - " + end.toLocaleDateString('en-us', { weekday:"short", day:"numeric"}) + " " + end.toLocaleTimeString(); - - } else { - return start.toLocaleDateString('en-us', { weekday:"short", month:"short", day:"numeric"}) + " " + start.toLocaleTimeString() + " - " + end.toLocaleTimeString(); - - } + const dateRange = (start, end) => { + if (start.getYear() != end.getYear()) { + return start.toLocaleDateString('en-us', { weekday: "short", year: "numeric", month: "short", day: "numeric" }) + " " + start.toLocaleTimeString() + " - " + end.toLocaleDateString('en-us', { weekday: "short", year: "numeric", month: "short", day: "numeric" }) + " " + end.toLocaleTimeString(); + } else if (start.getMonth() != end.getMonth()) { + return start.toLocaleDateString('en-us', { weekday: "short", month: "short", day: "numeric" }) + " " + start.toLocaleTimeString() + " - " + end.toLocaleDateString('en-us', { weekday: "short", month: "short", day: "numeric" }) + " " + end.toLocaleTimeString(); + } else if (start.getDay() != end.getDay()) { + return start.toLocaleDateString('en-us', { weekday: "short", month: "short", day: "numeric" }) + " " + start.toLocaleTimeString() + " - " + end.toLocaleDateString('en-us', { weekday: "short", day: "numeric" }) + " " + end.toLocaleTimeString(); + + } else { + return start.toLocaleDateString('en-us', { weekday: "short", month: "short", day: "numeric" }) + " " + start.toLocaleTimeString() + " - " + end.toLocaleTimeString(); } - - const {data:events, isSuccess} = useGetEventsQuery(); + + + } + + const { data: events, isSuccess } = useGetEventsQuery(); const navigate = useNavigate(); - - return ( -