Skip to content

Commit

Permalink
Add more tournament closing times
Browse files Browse the repository at this point in the history
  • Loading branch information
ximk committed Sep 9, 2024
1 parent f74d6cc commit cd46398
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/features/calendar/calendar-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ export const CALENDAR_EVENT = {

export const REG_CLOSES_AT_OPTIONS = [
"0",
"5min",
"10min",
"15min",
"30min",
"1h",
"1h30min",
Expand Down
15 changes: 15 additions & 0 deletions app/features/calendar/calendar-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ export function regClosesAtDate({
if (closesAt === "0") return startTime;

switch (closesAt) {
case "5min":
return new Date(startTime.getTime() - 5 * 60 * 1000);
case "10min":
return new Date(startTime.getTime() - 10 * 60 * 1000);
case "15min":
return new Date(startTime.getTime() - 15 * 60 * 1000);
case "30min":
return new Date(startTime.getTime() - 30 * 60 * 1000);
case "1h":
Expand Down Expand Up @@ -120,6 +126,12 @@ export function regClosesAtToDisplayName(closesAt: RegClosesAtOption) {
switch (closesAt) {
case "0":
return "At the start time";
case "5min":
return "5 minutes";
case "10min":
return "10 minutes";
case "15min":
return "15 minutes";
case "30min":
return "30 minutes";
case "1h":
Expand Down Expand Up @@ -154,6 +166,9 @@ export function datesToRegClosesAt({
}) {
const diff = startTime.getTime() - regClosesAt.getTime();
if (diff === 0) return "0";
if (diff === 5 * 60 * 1000) return "5min";
if (diff === 10 * 60 * 1000) return "10min";
if (diff === 15 * 60 * 1000) return "15min";
if (diff === 30 * 60 * 1000) return "30min";
if (diff === 60 * 60 * 1000) return "1h";
if (diff === 90 * 60 * 1000) return "1h30min";
Expand Down

0 comments on commit cd46398

Please sign in to comment.