Skip to content

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

✨ Improved time picker logic (#1166)

Luke Vellaa1af535eb7ba
diff --git a/apps/web/src/components/forms/poll-options-form/month-calendar/time-picker.tsx b/apps/web/src/components/forms/poll-options-form/month-calendar/time-picker.tsx
index 27c8957aa..90aa89cd9 100644
--- a/apps/web/src/components/forms/poll-options-form/month-calendar/time-picker.tsx
+++ b/apps/web/src/components/forms/poll-options-form/month-calendar/time-picker.tsx
@@ -34,9 +34,19 @@ const TimePicker: React.FunctionComponent<TimePickerProps> = ({
: dayjs(value).startOf("day");
const res: string[] = [];
- while (cursor.isSame(value, "day")) {
- res.push(cursor.toISOString());
- cursor = cursor.add(15, "minutes");
+
+ if (after) {
+ let cursor = dayjs(after).add(15, "minutes");
+ while (cursor.diff(after, "hours") < 24) {
+ res.push(cursor.toISOString());
+ cursor = cursor.add(15, "minutes");
+ }
+ } else {
+ cursor = dayjs(value).startOf("day");
+ while (cursor.isSame(value, "day")) {
+ res.push(cursor.toISOString());
+ cursor = cursor.add(15, "minutes");
+ }
}
return res;
}, [after, open, value]);