Skip to content

Commit

Permalink
Merge branch 'master' into final-update
Browse files Browse the repository at this point in the history
  • Loading branch information
joyc7 committed Dec 7, 2023
2 parents 049d584 + 14869bb commit 935869b
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion front-end/src/components/AddEvent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@ function AddEvent({ addEvent, onClose }) {
const [searchPerformed, setSearchPerformed] = useState(false);
const [selectedMember, setselectedMember] = useState([]);
const [loading, setLoading] = useState(false);

const getCurrentDate = () => {
const today = new Date();
const year = today.getFullYear();
let month = today.getMonth() + 1; // getMonth() returns 0-11
let day = today.getDate();

// Add leading zeros to month and day if they are less than 10
month = month < 10 ? `0${month}` : month;
day = day < 10 ? `0${day}` : day;

return `${year}-${month}-${day}`;
};
const [errors, setErrors] = useState({
eventName: false,
Date: false,
Expand All @@ -18,7 +31,7 @@ function AddEvent({ addEvent, onClose }) {
});
const [eventData, seteventData] = useState({
eventName: "",
Date: "",
Date: getCurrentDate(),
Description: "",
Members: [],
});
Expand Down

0 comments on commit 935869b

Please sign in to comment.