mirror of
https://github.com/lukevella/rallly.git
synced 2025-08-06 09:59:00 +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,
|
timeZone: string | null,
|
||||||
targetTimeZone: string,
|
targetTimeZone: string,
|
||||||
): ParsedTimeSlotOption => {
|
): ParsedTimeSlotOption => {
|
||||||
const start = dayjs(option.start).utc();
|
const adjustTimeZone = (date: Date | dayjs.Dayjs) => {
|
||||||
const startDate =
|
return timeZone && targetTimeZone
|
||||||
timeZone && targetTimeZone
|
? dayjs(date).utc().tz(timeZone, true).tz(targetTimeZone)
|
||||||
? start.tz(timeZone, true).tz(targetTimeZone)
|
: dayjs(date).utc();
|
||||||
: start;
|
};
|
||||||
|
const startDate = adjustTimeZone(option.start);
|
||||||
|
|
||||||
const endDate = startDate.add(option.duration, "minute");
|
const endDate = adjustTimeZone(
|
||||||
|
dayjs(option.start).add(option.duration, "minute"),
|
||||||
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
type: "timeSlot",
|
type: "timeSlot",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue