Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
🐛 Fix issue with applying times after midnight (#727)
Luke Vellaa45464bd5783
diff --git a/apps/web/src/components/forms/poll-options-form/month-calendar/month-calendar.tsx b/apps/web/src/components/forms/poll-options-form/month-calendar/month-calendar.tsxindex ca200b5c4..511dd8325 100644--- a/apps/web/src/components/forms/poll-options-form/month-calendar/month-calendar.tsx+++ b/apps/web/src/components/forms/poll-options-form/month-calendar/month-calendar.tsx@@ -150,6 +150,7 @@ const MonthCalendar: React.FunctionComponent<DateTimePickerProps> = ({: {type: "timeSlot",start: formatDateWithoutTz(selectedDate),+ duration,end: formatDateWithoutTz(dayjs(selectedDate).add(duration, "minutes")@@ -225,6 +226,7 @@ const MonthCalendar: React.FunctionComponent<DateTimePickerProps> = ({return {type: "timeSlot",start: formatDateWithoutTz(startDate),+ duration: duration,end: formatDateWithoutTz(endDate),};}),@@ -346,6 +348,7 @@ const MonthCalendar: React.FunctionComponent<DateTimePickerProps> = ({{type: "timeSlot",start: startTime,+ duration,end: formatDateWithoutTz(dayjs(new Date(startTime)).add(duration, "minutes")@@ -382,6 +385,7 @@ const MonthCalendar: React.FunctionComponent<DateTimePickerProps> = ({startTime: option.start.substring(option.start.indexOf("T"),),+ duration: option.duration,endTime: option.end.substring(option.end.indexOf("T"),),@@ -392,10 +396,15 @@ const MonthCalendar: React.FunctionComponent<DateTimePickerProps> = ({Object.keys(optionsByDay).forEach((dateString) => {times.forEach((time) => {+ const start =+ dateString + time.startTime;newOptions.push({type: "timeSlot",- start: dateString + time.startTime,- end: dateString + time.endTime,+ start: start,+ duration,+ end: dayjs(start)+ .add(duration, "minutes")+ .format("YYYY-MM-DDTHH:mm"),});});},diff --git a/apps/web/src/components/forms/poll-options-form/types.ts b/apps/web/src/components/forms/poll-options-form/types.tsindex efcaf6804..510b45bce 100644--- a/apps/web/src/components/forms/poll-options-form/types.ts+++ b/apps/web/src/components/forms/poll-options-form/types.ts@@ -6,6 +6,7 @@ export type DateOption = {export type TimeOption = {type: "timeSlot";start: string;+ duration: number;end: string;};diff --git a/apps/web/src/components/forms/poll-options-form/week-calendar.tsx b/apps/web/src/components/forms/poll-options-form/week-calendar.tsxindex b917af0a9..e4a0b1523 100644--- a/apps/web/src/components/forms/poll-options-form/week-calendar.tsx+++ b/apps/web/src/components/forms/poll-options-form/week-calendar.tsx@@ -157,6 +157,7 @@ const WeekCalendar: React.FunctionComponent<DateTimePickerProps> = ({const newEvent: DateTimeOption = {type: "timeSlot",start: formatDateWithoutTz(startDate),+ duration: dayjs(endDate).diff(endDate, "minutes"),end: formatDateWithoutTz(endDate),};diff --git a/apps/web/src/pages/poll/[urlId]/edit-options.tsx b/apps/web/src/pages/poll/[urlId]/edit-options.tsxindex 0410b69c8..4412dbaf8 100644--- a/apps/web/src/pages/poll/[urlId]/edit-options.tsx+++ b/apps/web/src/pages/poll/[urlId]/edit-options.tsx@@ -67,6 +67,7 @@ const Page: NextPageWithLayout = () => {? {type: "timeSlot",start: start.format("YYYY-MM-DDTHH:mm:ss"),+ duration: option.duration,end: start.add(option.duration, "minute").format("YYYY-MM-DDTHH:mm:ss"),diff --git a/apps/web/src/utils/date-time-utils.ts b/apps/web/src/utils/date-time-utils.tsindex 3410f4128..0c8821030 100644--- a/apps/web/src/utils/date-time-utils.ts+++ b/apps/web/src/utils/date-time-utils.ts@@ -40,8 +40,6 @@ export interface ParsedTimeSlotOption {export type ParsedDateTimeOpton = ParsedDateOption | ParsedTimeSlotOption;-const isTimeSlot = (value: string) => value.indexOf("/") !== -1;-export const getDuration = (startTime: dayjs.Dayjs, endTime: dayjs.Dayjs) => {const hours = Math.floor(endTime.diff(startTime, "hours"));const minutes = Math.floor(endTime.diff(startTime, "minute") - hours * 60);@@ -157,19 +155,3 @@ export const expectTimeOption = (d: DateTimeOption): TimeOption => {}return d;};--export const parseValue = (value: string): DateTimeOption => {- if (isTimeSlot(value)) {- const [start, end] = value.split("/");- return {- type: "timeSlot",- start,- end,- };- } else {- return {- type: "date",- date: value,- };- }-};