Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

Revert legacy poll date formatting

Luke Vellae830d0b0f495
diff --git a/pages/api/legacy/[urlId].ts b/pages/api/legacy/[urlId].ts
index ee7327e5b..0e617de13 100644
--- a/pages/api/legacy/[urlId].ts
+++ b/pages/api/legacy/[urlId].ts
@@ -82,7 +82,7 @@ export default async function handler(
const date = legacyPoll.dates[i].toISOString();
newOptions.push({
id: await nanoid(),
- value: date.substring(0, date.indexOf("T")), // remove time
+ value: date,
});
}
diff --git a/utils/date-time-utils.ts b/utils/date-time-utils.ts
index edacd7608..beb0d1b87 100644
--- a/utils/date-time-utils.ts
+++ b/utils/date-time-utils.ts
@@ -63,7 +63,8 @@ export const decodeDateOption = (
}
// we add the time because otherwise Date will assume UTC time which might change the day for some time zones
- const date = new Date(option + "T00:00:00");
+ const dateString = option.indexOf("T") === -1 ? option + "T00:00:00" : option;
+ const date = new Date(dateString);
return {
type: "date",
day: format(date, "dd"),