mirror of
https://github.com/lukevella/rallly.git
synced 2025-07-30 06:29:11 +02:00
✨ Improved time picker logic (#1166)
This commit is contained in:
parent
e5be3166ea
commit
a1af535eb7
1 changed files with 13 additions and 3 deletions
|
@ -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]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue