fix Former time in wrong time zone (Rescheduling) (#9039)

* fix Former time in wrong time zone (Rescheduling)

* eslint fixed

* yarn.lock push

* little bit of code formatting

* [eslint: fix] missing semi-colon

* linting errors fixed

* Update packages/lib/parse-dates.ts

* returning yarn lock to main

* Refactor constant and functions

* Consider time format in new function

* Fix 24 time format with am/pm

---------

Co-authored-by: alannnc <[email protected]>
This commit is contained in:
Aashish Upadhyayandalannnc authored and GitHub committed 2023-05-23 07:50:47 +00:00
1 parent 5e1eb7bd72
commit d31648e37a
2 files changed
+44 -2

No files matched your search

@@ -22,6 +22,7 @@ import {
useIsEmbed,
} from "@calcom/embed-core/embed-iframe";
import { createBooking, createRecurringBooking } from "@calcom/features/bookings/lib";
import { useTimePreferences } from "@calcom/features/bookings/lib";
import {
getBookingFieldsWithSystemFields,
SystemField,
@@ -39,7 +40,7 @@ import { useLocale } from "@calcom/lib/hooks/useLocale";
import useTheme from "@calcom/lib/hooks/useTheme";
import { useTypedQuery } from "@calcom/lib/hooks/useTypedQuery";
import { HttpError } from "@calcom/lib/http-error";
import { parseDate, parseRecurringDates } from "@calcom/lib/parse-dates";
import { parseDate, parseDateTimeWithTimeZone, parseRecurringDates } from "@calcom/lib/parse-dates";
import { getEveryFreqFor } from "@calcom/lib/recurringStrings";
import { telemetryEventTypes, useTelemetry } from "@calcom/lib/telemetry";
import { TimeFormat } from "@calcom/lib/timeFormat";
@@ -231,6 +232,8 @@ const BookingPage = ({
{}
);
const { timezone } = useTimePreferences();
const reserveSlot = () => {
if (queryDuration) {
reserveSlotMutation.mutate({
@@ -602,7 +605,7 @@ const BookingPage = ({
<Calendar className="ml-[2px] -mt-1 inline-block h-4 w-4 ltr:mr-[10px] rtl:ml-[10px]" />
{isClientTimezoneAvailable &&
typeof booking.startTime === "string" &&
parseDate(dayjs(booking.startTime), i18n.language, {
parseDateTimeWithTimeZone(booking.startTime, i18n.language, timezone, {
selectedTimeFormat: timeFormat,
})}
</p>