Skip to content

Commit

Permalink
Merge pull request #89 from AlaaN-Smadi/fix/all-day-event
Browse files Browse the repository at this point in the history
fix(eventDate): display all date event - PLUG-4444
  • Loading branch information
mas-iota authored Sep 22, 2024
2 parents bb294f2 + 10cdd1c commit 095706f
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 16 deletions.
4 changes: 4 additions & 0 deletions control/content/controllers/content.event.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,10 @@
ContentEvent.event.data.timezone = "";
ContentEvent.event.data.timeDisplay = "USER";
ContentEvent.displayTiming = "USER"
ContentEvent.event.data.startDate = new Date(ContentEvent.event.data.startDate).setHours(0, 0, 0, 0);
ContentEvent.event.data.endDate = new Date(ContentEvent.event.data.endDate).setHours(23, 59, 0, 0);
ContentEvent.event.data.startTime = ContentEvent.event.data.startDate;
ContentEvent.event.data.endTime = ContentEvent.event.data.endDate;
}
if (ContentEvent.event.data.repeat) {
if (ContentEvent.event.data.repeat.startDate != ContentEvent.event.lastSavedStartDate) {
Expand Down
23 changes: 23 additions & 0 deletions widget/controllers/widget.home.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,29 @@
else return new Date(event.data.startDate);
}

$scope.startTimeToShow = function (event) {
const defaultStartDate = configureDate.getFullYear() + "-" + moment(configureDate).format("MM") + "-" + WidgetHome.getFirstDateOfMonth(configureDate) + "T00:00:00" + moment(new Date()).format("Z");
if (defaultStartDate === eventStartDate) return new Date(event.data.startDate);

const currentDateStart = new Date(eventStartDate).setHours(0,0,0,0);
const _eventStartDate = new Date(event.data.startDate).setHours(0,0,0,0);
if (currentDateStart === _eventStartDate) {
return new Date(event.data.startDate);
} else {
return new Date(eventStartDate);
}
}

$scope.endTimeToShow = function (event) {
const currentDateEnd = new Date(eventRecEndDate).setHours(0,0,0,0);
const _eventEndDate = new Date(event.data.endDate).setHours(0,0,0,0);
if (currentDateEnd === _eventEndDate) {
return new Date(event.data.endDate);
} else {
return new Date(eventRecEndDate);
}
}

/**
* init() function invocation to fetch previously saved user's data from datastore.
*/
Expand Down
11 changes: 8 additions & 3 deletions widget/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,16 @@ <h1 class="text-primary margin-zero">{{dateToShow(event) | getDate}}</h1>
<a href="javascript:void(0)" ng-click="WidgetHome.openDetailsPage(event)">
<h4 class="margin-bottom-zero text-primary ellipsis">{{event.data.title}}</h4>
</a>
<p class="margin-zero ellipsis" ng-if="event.data.endTime && !event.data.isAllDay">
{{event.data.startTime | date: "hh:mm a"}} - {{event.data.endTime | date: "hh:mm a"}}
<p class="margin-zero ellipsis" ng-if="event.data.endTime && (!event.data.isAllDay || !isSameDate(event))">
<span ng-if="isSameDate(event)">
{{event.data.startTime | date: "hh:mm a"}} - {{event.data.endTime | date: "hh:mm a"}}
</span>
<span ng-if="!isSameDate(event)">
{{startTimeToShow(event) | date: "hh:mm a"}} - {{endTimeToShow(event) | date: "hh:mm a"}}
</span>
{{event.data.startTime && (event.data.startTime | getTimeZone) || ""}}
</p>
<p class="margin-zero ellipsis" ng-if="event.data.isAllDay">All Day</p>
<p class="margin-zero ellipsis" ng-if="event.data.isAllDay && isSameDate(event)">All Day</p>
</div>
</div>
</div>
Expand Down
10 changes: 7 additions & 3 deletions widget/templates/Event_Item_2.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,16 @@ <h1 class="margin-zero text-primary">
{{WidgetEvent.event.data.title}}</p>

<p class="margin-bottom-zero ellipsis titleBarTextAndIcons"
ng-if="((WidgetEvent.event.data.endTime >= 0) && (!WidgetEvent.event.data.isAllDay))">
ng-if="((WidgetEvent.event.data.endTime >= 0) && (!WidgetEvent.event.data.isAllDay) && isSameDate(WidgetEvent.event))">
{{WidgetEvent.event.data.startTime | date: "hh:mm a"}} - {{WidgetEvent.event.data.endTime | date: "hh:mm a"}}
{{WidgetEvent.event.data.startTime && (WidgetEvent.event.data.startTime | getTimeZone) || ""}}</p>
<p class="margin-bottom-zero ellipsis titleBarTextAndIcons"
ng-if="WidgetEvent.event.data.isAllDay">
All Day</p>
ng-if="!isSameDate(WidgetEvent.event)">
{{WidgetEvent.event.data.startTime | date: "MMM d, hh:mm a"}} - {{WidgetEvent.event.data.endTime | date: "MMM d, hh:mm a"}}
{{WidgetEvent.event.data.startTime && (WidgetEvent.event.data.startTime | getTimeZone) || ""}}</p>
<p class="margin-bottom-zero ellipsis titleBarTextAndIcons"
ng-if="WidgetEvent.event.data.isAllDay && isSameDate(WidgetEvent.event)">
All Day</p>
</div>
</div>
</div>
Expand Down
15 changes: 9 additions & 6 deletions widget/templates/Event_Item_3.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@ <h1 class="margin-zero text-primary">
{{WidgetEvent.event.data.title}}</p>

<p class="margin-bottom-zero ellipsis whiteTheme"
ng-if="((WidgetEvent.event.data.endTime >= 0) && (!WidgetEvent.event.data.isAllDay))">
{{WidgetEvent.event.data.startTime | date: "hh:mm a"}} - {{WidgetEvent.event.data.endTime | date: "hh:mm a"}}
{{WidgetEvent.event.data.startTime && (WidgetEvent.event.data.startTime | getTimeZone) || ""}}</p>
<p class="margin-bottom-zero ellipsis whiteTheme"
ng-if="WidgetEvent.event.data.isAllDay">
All Day</p>
ng-if="((WidgetEvent.event.data.endTime >= 0) && (!WidgetEvent.event.data.isAllDay) && isSameDate(WidgetEvent.event))">
{{WidgetEvent.event.data.startTime | date: "hh:mm a"}} - {{WidgetEvent.event.data.endTime | date: "hh:mm a"}}
{{WidgetEvent.event.data.startTime && (WidgetEvent.event.data.startTime | getTimeZone) || ""}}</p>
<p class="margin-bottom-zero ellipsis whiteTheme"
ng-if="!isSameDate(WidgetEvent.event)">
{{WidgetEvent.event.data.startTime | date: "MMM d, hh:mm a"}} - {{WidgetEvent.event.data.endTime | date: "MMM d, hh:mm a"}}
{{WidgetEvent.event.data.startTime && (WidgetEvent.event.data.startTime | getTimeZone) || ""}}</p>
<p class="margin-bottom-zero ellipsis whiteTheme"
ng-if="WidgetEvent.event.data.isAllDay && isSameDate(WidgetEvent.event)">All Day</p>
</div>
</div>
<div class="padded text-center clearfix padding-bottom-ten">
Expand Down
11 changes: 7 additions & 4 deletions widget/templates/Event_Item_4.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@ <h1 class="margin-zero whiteTheme">{{WidgetEvent.event.data.startDate |
{{WidgetEvent.event.data.title}}</p>

<p class="margin-bottom-zero ellipsis"
ng-if="((WidgetEvent.event.data.endTime >= 0) && (!WidgetEvent.event.data.isAllDay))">
ng-if="((WidgetEvent.event.data.endTime >= 0) && (!WidgetEvent.event.data.isAllDay) && isSameDate(WidgetEvent.event))">
{{WidgetEvent.event.data.startTime | date: "hh:mm a"}} - {{WidgetEvent.event.data.endTime | date: "hh:mm a"}}
{{WidgetEvent.event.data.startTime && (WidgetEvent.event.data.startTime | getTimeZone) || ""}}</p>
<p class="margin-bottom-zero ellipsis"
ng-if="WidgetEvent.event.data.isAllDay">
All Day</p>
<p class="margin-bottom-zero ellipsis"
ng-if="!isSameDate(WidgetEvent.event)">
{{WidgetEvent.event.data.startTime | date: "MMM d, hh:mm a"}} - {{WidgetEvent.event.data.endTime | date: "MMM d, hh:mm a"}}
{{WidgetEvent.event.data.startTime && (WidgetEvent.event.data.startTime | getTimeZone) || ""}}</p>
<p class="margin-bottom-zero ellipsis"
ng-if="WidgetEvent.event.data.isAllDay && isSameDate(WidgetEvent.event)">All Day</p>
</div>
</div>
<div class="padded text-center clearfix padding-bottom-ten">
Expand Down

0 comments on commit 095706f

Please sign in to comment.