mirror of
https://github.com/lukevella/rallly.git
synced 2025-08-03 08:28:35 +02:00
🐛 Fix bug where incorrect end time is shown
This commit is contained in:
parent
b2dfee4042
commit
712616e0f6
1 changed files with 9 additions and 6 deletions
|
@ -101,13 +101,16 @@ const parseTimeSlotOption = (
|
|||
timeZone: string | null,
|
||||
targetTimeZone: string,
|
||||
): ParsedTimeSlotOption => {
|
||||
const start = dayjs(option.start).utc();
|
||||
const startDate =
|
||||
timeZone && targetTimeZone
|
||||
? start.tz(timeZone, true).tz(targetTimeZone)
|
||||
: start;
|
||||
const adjustTimeZone = (date: Date | dayjs.Dayjs) => {
|
||||
return timeZone && targetTimeZone
|
||||
? dayjs(date).utc().tz(timeZone, true).tz(targetTimeZone)
|
||||
: dayjs(date).utc();
|
||||
};
|
||||
const startDate = adjustTimeZone(option.start);
|
||||
|
||||
const endDate = startDate.add(option.duration, "minute");
|
||||
const endDate = adjustTimeZone(
|
||||
dayjs(option.start).add(option.duration, "minute"),
|
||||
);
|
||||
|
||||
return {
|
||||
type: "timeSlot",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue