fix: start and end date for ooo entry (#13284)

Co-authored-by: CarinaWolli <[email protected]>
Co-authored-by: sean-brydon <[email protected]>
Co-authored-by: sean-brydon <[email protected]>
This commit is contained in:
authored and GitHub committed 2024-01-19 04:00:21 +00:00
1 parent 833a91375e
commit a25cd43ddf
4 files changed
+36 -28

No files matched your search

@@ -26,6 +26,7 @@ import PageWrapper from "@components/PageWrapper";
export type BookingRedirectForm = {
dateRange: { startDate: Date; endDate: Date };
offset: number;
toTeamUserId: number | null;
};
@@ -47,6 +48,7 @@ const OutOfOfficeSection = () => {
startDate: dateRange.startDate,
endDate: dateRange.endDate,
},
offset: dayjs().utcOffset(),
toTeamUserId: null,
},
});
@@ -104,20 +106,17 @@ const OutOfOfficeSection = () => {
</div>
)}
</div>
<div className="mt-4 flex flex-row">
<div className="mt-4 grid grid-rows-2 gap-2 md:grid-cols-2">
{profileRedirect && (
<div className="mr-2 w-1/2 lg:w-1/3">
<div>
<p className="text-emphasis block text-sm font-medium">{t("team_member")}</p>
<Select
className="mt-1 h-4 max-w-[350px] text-white"
className="mt-1 h-4 text-white"
name="toTeamUsername"
data-testid="team_username_select"
value={selectedMember}
placeholder={t("select_team_member")}
isSearchable
innerClassNames={{
control: "h-[38px]",
}}
options={memberListOptions}
onChange={(selectedOption) => {
if (selectedOption?.value) {
@@ -128,25 +127,27 @@ const OutOfOfficeSection = () => {
/>
</div>
)}
<div className="w-1/2 lg:w-1/3">
<div>
<p className="text-emphasis mb-1 block text-sm font-medium">{t("time_range")}</p>
<Controller
name="dateRange"
control={control}
defaultValue={dateRange}
render={() => (
<DateRangePicker
startDate={getValues("dateRange").startDate}
endDate={getValues("dateRange").endDate}
onDatesChange={({ startDate, endDate }) => {
setValue("dateRange", {
startDate,
endDate,
});
}}
/>
)}
/>
<div>
<Controller
name="dateRange"
control={control}
defaultValue={dateRange}
render={() => (
<DateRangePicker
startDate={getValues("dateRange").startDate}
endDate={getValues("dateRange").endDate}
onDatesChange={({ startDate, endDate }) => {
setValue("dateRange", {
startDate,
endDate,
});
}}
/>
)}
/>
</div>
</div>
</div>
</div>
@@ -195,7 +196,7 @@ const OutOfOfficeEntriesList = () => {
<TableRow key={item.id} data-testid={`table-redirect-${item.toUser?.username || "n-a"}`}>
<TableCell>
<p className="px-2">
{dayjs(item.start).format("ll")} - {dayjs(item.end).format("ll")}
{dayjs.utc(item.start).format("ll")} - {dayjs.utc(item.end).format("ll")}
</p>
</TableCell>
<TableCell>