From 25d59c0240221ae7cf0096c00ac6a637033377f5 Mon Sep 17 00:00:00 2001 From: dzonidoo Date: Thu, 24 Oct 2024 10:55:22 +0200 Subject: [PATCH] changes after review --- client/components/Events/EventDateTime.tsx | 6 +++--- client/components/Events/EventDateTimeColumn.tsx | 4 ++-- client/components/Events/EventItem.tsx | 2 +- client/components/Planning/PlanningItemWithEvents.tsx | 2 +- client/interfaces.ts | 2 +- client/utils/events.ts | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/client/components/Events/EventDateTime.tsx b/client/components/Events/EventDateTime.tsx index 94547eee1..6ed80b8a4 100644 --- a/client/components/Events/EventDateTime.tsx +++ b/client/components/Events/EventDateTime.tsx @@ -13,7 +13,7 @@ interface IProps { item: IEventItem; ignoreAllDay?: boolean; displayLocalTimezone?: boolean; - planningItem?: IPlanningListItemProps; + planningProps?: IPlanningListItemProps; } export class EventDateTime extends React.PureComponent { @@ -24,7 +24,7 @@ export class EventDateTime extends React.PureComponent { const end = eventUtils.getEndDate(item); const isAllDay = eventUtils.isEventAllDay(start, end); const multiDay = !eventUtils.isEventSameDay(start, end); - const showEventStartDate = eventUtils.showEventStartDate(start, this.props.planningItem?.date); + const showEventStartDate = eventUtils.showEventStartDate(start, multiDay, this.props.planningProps?.date); const isRemoteTimeZone = timeUtils.isEventInDifferentTimeZone(item); const withYear = multiDay && start.year() !== end.year(); const localStart = timeUtils.getLocalDate(start, item.dates.tz); @@ -81,7 +81,7 @@ export class EventDateTime extends React.PureComponent { )} { @@ -24,7 +24,7 @@ export class EventDateTimeColumn extends React.PureComponent { return ( - + ); diff --git a/client/components/Events/EventItem.tsx b/client/components/Events/EventItem.tsx index 5bf3dbb15..0d64a688c 100644 --- a/client/components/Events/EventItem.tsx +++ b/client/components/Events/EventItem.tsx @@ -305,7 +305,7 @@ class EventItemComponent extends React.Component { {listViewType === LIST_VIEW_TYPE.SCHEDULE ? null : ( { {...this.props.getEventProps(event)} multiSelectDisabled key={event._id} - planningItem={planningProps} + planningProps={planningProps} /> ); }) diff --git a/client/interfaces.ts b/client/interfaces.ts index 208d8b3e4..9e3394e0b 100644 --- a/client/interfaces.ts +++ b/client/interfaces.ts @@ -906,7 +906,7 @@ export interface IAssignmentItem extends IBaseRestApiResponse { export interface IBaseListItemProps { item: T; - planningItem?: IPlanningListItemProps; + planningProps?: IPlanningListItemProps; lockedItems: ILockedItems; session: ISession; privileges: {[key: string]: number}; diff --git a/client/utils/events.ts b/client/utils/events.ts index e597e1803..d136fea94 100644 --- a/client/utils/events.ts +++ b/client/utils/events.ts @@ -80,11 +80,11 @@ function isEventSameDay(startingDate: IDateTime, endingDate: IDateTime): boolean return moment(startingDate).format('DD/MM/YYYY') === moment(endingDate).format('DD/MM/YYYY'); } -function showEventStartDate(eventDate: IDateTime, planningDate?: IDateTime): boolean { +function showEventStartDate(eventDate: IDateTime, multiDay: boolean, planningDate?: IDateTime): boolean { if (planningDate == null) { return true; } - return moment(eventDate).format('DD/MM/YYYY') != moment(planningDate).format('DD/MM/YYYY'); + return (!moment(eventDate).isSame(planningDate, 'day') || multiDay); } function eventHasPlanning(event: IEventItem): boolean {