-
{formatDate(DateTime.fromISO(resource.date))}
+
{formatDate(DateTime.fromISO(resource.date, { zone: DEFAULT_TIMEZONE }))}
diff --git a/csm_web/frontend/src/components/section/Section.tsx b/csm_web/frontend/src/components/section/Section.tsx
index 3e6ced65..1936fc5b 100644
--- a/csm_web/frontend/src/components/section/Section.tsx
+++ b/csm_web/frontend/src/components/section/Section.tsx
@@ -5,6 +5,7 @@ import MentorSection from "./MentorSection";
import { Override, Spacetime } from "../../utils/types";
import { useSection } from "../../utils/queries/sections";
import LoadingSpinner from "../LoadingSpinner";
+import { formatSpacetimeInterval } from "../../utils/datetime";
export const ROLES = Object.freeze({ COORDINATOR: "COORDINATOR", STUDENT: "STUDENT", MENTOR: "MENTOR" });
@@ -89,24 +90,19 @@ interface SectionSpacetimeProps {
override?: Override;
}
-export function SectionSpacetime({
- manySpacetimes,
- index,
- spacetime: { location, time },
- override,
- children
-}: SectionSpacetimeProps) {
+export function SectionSpacetime({ manySpacetimes, index, spacetime, override, children }: SectionSpacetimeProps) {
+ const location = spacetime.location;
return (
{children}
- {time}
+ {formatSpacetimeInterval(spacetime)}
{override && (
Adjusted for {override.date}
- {override.spacetime.time}
+ {formatSpacetimeInterval(override.spacetime)}
)}
diff --git a/csm_web/frontend/src/components/section/SpacetimeEditModal.tsx b/csm_web/frontend/src/components/section/SpacetimeEditModal.tsx
index bbebee6f..0b1010de 100644
--- a/csm_web/frontend/src/components/section/SpacetimeEditModal.tsx
+++ b/csm_web/frontend/src/components/section/SpacetimeEditModal.tsx
@@ -1,11 +1,11 @@
import { DateTime } from "luxon";
import React, { useState } from "react";
+import { DAYS_OF_WEEK } from "../../utils/datetime";
import { useSpacetimeModifyMutation, useSpacetimeOverrideMutation } from "../../utils/queries/spacetime";
import { Spacetime } from "../../utils/types";
import LoadingSpinner from "../LoadingSpinner";
import Modal from "../Modal";
import TimeInput from "../TimeInput";
-import { DAYS_OF_WEEK } from "./utils";
interface SpacetimeEditModalProps {
sectionId: number;
@@ -20,10 +20,9 @@ const SpaceTimeEditModal = ({
defaultSpacetime: { id: spacetimeId, startTime: timeString, location: prevLocation, dayOfWeek },
editingOverride
}: SpacetimeEditModalProps): React.ReactElement => {
- const sliceIndex = timeString.split(":").length < 3 ? timeString.indexOf(":") : timeString.lastIndexOf(":");
const [location, setLocation] = useState
(prevLocation);
const [day, setDay] = useState(dayOfWeek);
- const [time, setTime] = useState(timeString.slice(0, sliceIndex));
+ const [time, setTime] = useState(timeString);
const [isPermanent, setIsPermanent] = useState(false);
const [date, setDate] = useState("");
const [mode, setMode] = useState(prevLocation && prevLocation.startsWith("http") ? "virtual" : "inperson");
@@ -38,13 +37,13 @@ const SpaceTimeEditModal = ({
setShowSaveSpinner(true);
isPermanent
? spacetimeModifyMutation.mutate({
- day_of_week: day,
+ dayOfWeek,
location: location,
- start_time: `${time}:00`
+ startTime: time
})
: spacetimeOverrideMutation.mutate({
location: location,
- start_time: `${time}:00`,
+ startTime: time,
date: date
});
closeModal();
@@ -100,15 +99,15 @@ const SpaceTimeEditModal = ({