* update to display availability page as per weekstart setting * update to accomodate any day * update for AvailabilityTab * reusable and tests added * update test description --------- Co-authored-by: Amit Sharma <[email protected]>
This commit is contained in:
1 parent
13ec930a61
commit
283ca9fc74
7 files changed
+138
-14
No files matched your search
@@ -10,6 +10,7 @@ import WebShell from "@calcom/features/shell/Shell";
|
||||
import { availabilityAsString } from "@calcom/lib/availability";
|
||||
import classNames from "@calcom/lib/classNames";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { sortAvailabilityStrings } from "@calcom/lib/weekstart";
|
||||
import type { RouterOutputs } from "@calcom/trpc/react";
|
||||
import type { TimeRange, WorkingHours } from "@calcom/types/schedule";
|
||||
import {
|
||||
@@ -291,11 +292,17 @@ export function AvailabilitySettings({
|
||||
schedule ? (
|
||||
schedule.schedule
|
||||
.filter((availability) => !!availability.days.length)
|
||||
.map((availability) => (
|
||||
<span
|
||||
key={availability.startTime.valueOf().toString()}
|
||||
className={cn(customClassNames?.subtitlesClassName)}>
|
||||
{availabilityAsString(availability, { locale: i18n.language, hour12: timeFormat === 12 })}
|
||||
.map((availability) =>
|
||||
availabilityAsString(availability, {
|
||||
locale: i18n.language,
|
||||
hour12: timeFormat === 12,
|
||||
})
|
||||
)
|
||||
// sort the availability strings as per user's weekstart (settings)
|
||||
.sort(sortAvailabilityStrings(i18n.language, weekStart))
|
||||
.map((availabilityString, index) => (
|
||||
<span key={index} className={cn(customClassNames?.subtitlesClassName)}>
|
||||
{availabilityString}
|
||||
<br />
|
||||
</span>
|
||||
))
|
||||
|
||||
+1
-1
@@ -99,7 +99,7 @@ export const AvailabilitySettingsPlatformWrapper = ({
|
||||
handleSubmit={async (data) => {
|
||||
atomSchedule.id && handleUpdate(atomSchedule.id, data);
|
||||
}}
|
||||
weekStart="Sunday"
|
||||
weekStart={me?.data?.weekStart || "Sunday"}
|
||||
timeFormat={timeFormat}
|
||||
enableOverrides={enableOverrides}
|
||||
isLoading={isLoading}
|
||||
|
||||
Reference in new issue
Block a user