Skip to content

Commit

Permalink
83 final day planner adjustments (#91)
Browse files Browse the repository at this point in the history
* finished?

* fixed one day off bug?

---------

Co-authored-by: chloecheng8 <[email protected]>
Co-authored-by: ThatMegamind <[email protected]>
Co-authored-by: Cheryl Chen <[email protected]>
Co-authored-by: michellelin1 <[email protected]>
  • Loading branch information
5 people authored Apr 29, 2024
1 parent d15e24c commit 54542b4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ const AddEventToPublishedScheduleForm = ({ closeForm }) => {
variant: 'subtle',
position: 'top-right',
containerStyle: {
mt: '6rem',
mt: '3rem',
mr: '2rem'
},
duration: 3000,
isClosable: true,
Expand Down
3 changes: 2 additions & 1 deletion src/components/Catalog/CatalogTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ const CatalogTable = ({ tableData, handleActionClick, onDayPlanner, setCurrEvent
:
<Td>
<IconButton
color="gray.400"
fontSize='24px'
color="gray.500"
backgroundColor="transparent"
p="0.5rem"
h="fit-content"
Expand Down
7 changes: 6 additions & 1 deletion src/components/Planner/PlannerEvents/PlannerEvents.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,18 @@ const PlannerEvents = ({ onClose }) => {
const [dataShouldRevalidate, setShouldDataRevalidate] = useState(false);
const plannedEvents = plannedEventsContext[0];

const getUTCDate = (eventDate) => {
const utcDate = new Date(eventDate);
return new Date(utcDate.getTime() + utcDate.getTimezoneOffset() * 60000);
}

const getDayData = async () => {
try {
// console.log('getDayData');
const response = await NPOBackend.get(`/day/${dayId}`);
const responseData = response.data[0];
const [datePart] = responseData.eventDate.split('T');
const dateObj = new Date(responseData.eventDate);
const dateObj = getUTCDate(responseData.eventDate);
// console.log(dateObj);
setDateHeader(dateObj.toLocaleDateString({ year: 'numeric', month: 'short', day: '2-digit' }));
setDayData({id: responseData.id, eventDate: datePart, location: responseData.location, details: responseData.notes});
Expand Down
6 changes: 4 additions & 2 deletions src/pages/PublishedSchedule/PublishedSchedule.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ const PublishedSchedule = () => {
data.unshift(curSeason);
}

setSelectedSeason(curSeason);
if (selectedSeason === '') {
setSelectedSeason(curSeason);
}

const seasonOrder = ['Fall', 'Summer', 'Spring'];
data.sort((a, b) => {
Expand All @@ -54,7 +56,7 @@ const PublishedSchedule = () => {

};
renderTable();
}, [currentUser, curSeason]);
}, [currentUser, curSeason, allSeasons]);

//update chakra table container accordingly
return (
Expand Down

0 comments on commit 54542b4

Please sign in to comment.