mirror of
https://github.com/lukevella/rallly.git
synced 2025-05-13 17:06:48 +02:00
🏗️ Update how we store date values
This also fixes a few bugs: - some values had end times that were before the start times - some values has end times a couple of days in the future It’s not entirely clear how users were able to set these values but this update fixes these values and helps avoid similar issues in the future.
This commit is contained in:
parent
8a9159c322
commit
51c5016656
12 changed files with 203 additions and 158 deletions
|
@ -4,7 +4,6 @@ import React from "react";
|
|||
|
||||
import { usePostHog } from "@/utils/posthog";
|
||||
|
||||
import { encodeDateOption } from "../utils/date-time-utils";
|
||||
import { trpc } from "../utils/trpc";
|
||||
import { Button } from "./button";
|
||||
import {
|
||||
|
@ -102,7 +101,6 @@ const Page: React.FunctionComponent = () => {
|
|||
|
||||
await createPoll.mutateAsync({
|
||||
title: title,
|
||||
type: "date",
|
||||
location: formData?.eventDetails?.location,
|
||||
description: formData?.eventDetails?.description,
|
||||
user: session.user.isGuest
|
||||
|
@ -112,7 +110,10 @@ const Page: React.FunctionComponent = () => {
|
|||
}
|
||||
: undefined,
|
||||
timeZone: formData?.options?.timeZone,
|
||||
options: required(formData?.options?.options).map(encodeDateOption),
|
||||
options: required(formData?.options?.options).map((option) => ({
|
||||
startDate: option.type === "date" ? option.date : option.start,
|
||||
endDate: option.type === "timeSlot" ? option.end : undefined,
|
||||
})),
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue