Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/app/profile/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ export default function Profile() {
const [joinTeamCode, setJoinTeamCode] = useState("");
const [joining, setJoining] = useState(false);

// Check if editing is allowed (until Jan 1st, 2026)
const isEditingAllowed = new Date() < new Date('2026-01-02T09:00:00');
// Check if editing is allowed (until Jan 2nd, 3PM 2026)
const isEditingAllowed = new Date() < new Date('2026-01-02T15:00:00');
Comment on lines +40 to +41
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The deadline date '2026-01-02T15:00:00' does not specify a timezone, which means it will be interpreted differently based on each user's local timezone. This could result in inconsistent deadline enforcement across different geographical locations. Consider using a specific timezone (e.g., '2026-01-02T15:00:00Z' for UTC or '2026-01-02T15:00:00-05:00' for EST) to ensure all users experience the same deadline.

Suggested change
// Check if editing is allowed (until Jan 2nd, 3PM 2026)
const isEditingAllowed = new Date() < new Date('2026-01-02T15:00:00');
// Check if editing is allowed (until Jan 2nd, 3PM 2026, in UTC)
const isEditingAllowed = new Date() < new Date('2026-01-02T15:00:00Z');

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The isEditingAllowed constant is evaluated only once when the component mounts. If a user keeps the page open past the deadline (e.g., opens it at 2:59 PM and stays on the page past 3:00 PM), the deadline check won't update. Consider moving this check inside the useEffect or using a state variable that updates periodically to ensure the deadline is enforced even for users who keep the page open.

Suggested change
const isEditingAllowed = new Date() < new Date('2026-01-02T15:00:00');
const [isEditingAllowed, setIsEditingAllowed] = useState(() => new Date() < new Date('2026-01-02T15:00:00'));
useEffect(() => {
const deadlineTime = new Date('2026-01-02T15:00:00').getTime();
const updateEditingAllowed = () => {
setIsEditingAllowed(Date.now() < deadlineTime);
};
updateEditingAllowed();
const intervalId = setInterval(updateEditingAllowed, 60_000);
return () => {
clearInterval(intervalId);
};
}, []);

Copilot uses AI. Check for mistakes.

useEffect(() => {
if (user == null || user === undefined) {
Expand Down
11 changes: 11 additions & 0 deletions src/app/register/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,23 @@ const MyForm: React.FC = () => {
const [popUp, setPopUp] = useState(false);
const [agreedToRules, setAgreedToRules] = useState(false);
const [isCompleteRegistration, setIsCompleteRegistration] = useState(false);

// Check if registration is still open (until Jan 2nd, 3PM 2026)
const isRegistrationOpen = new Date() < new Date('2026-01-02T15:00:00');
Comment on lines +37 to +38
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The deadline date '2026-01-02T15:00:00' does not specify a timezone, which means it will be interpreted differently based on each user's local timezone. This could result in inconsistent deadline enforcement across different geographical locations. Consider using a specific timezone (e.g., '2026-01-02T15:00:00Z' for UTC or '2026-01-02T15:00:00-05:00' for EST) to ensure all users experience the same deadline.

Suggested change
// Check if registration is still open (until Jan 2nd, 3PM 2026)
const isRegistrationOpen = new Date() < new Date('2026-01-02T15:00:00');
// Check if registration is still open (until Jan 2nd, 3PM 2026, UTC)
const isRegistrationOpen = new Date() < new Date('2026-01-02T15:00:00Z');

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The isRegistrationOpen constant is evaluated only once when the component mounts. If a user keeps the page open past the deadline (e.g., opens it at 2:59 PM and stays on the page past 3:00 PM), the deadline check won't update. Consider moving this check inside the useEffect or using a state variable that updates periodically to ensure the deadline is enforced even for users who keep the page open.

Copilot uses AI. Check for mistakes.

useEffect(() => {
if (user === null) {
alert("Please login to register for Techsprint");
window.location.href = "/";
return;
}

// Check registration deadline
if (!isRegistrationOpen) {
alert("Registration deadline has passed. Registration closed on January 2nd, 2026 at 3PM.");
window.location.href = "/";
return;
}
GetUserProgress(user.uid).then((response) => {
console.log(response);
if (response === Progress.noApplication) {
Expand Down
Loading