From 9b7002e44401151c37bfb66931bc721890340fd3 Mon Sep 17 00:00:00 2001
From: alaa smadi
Date: Wed, 4 Sep 2024 12:57:05 -0400
Subject: [PATCH 1/2] fix(eventDate): display all date event
handle displaying all day event for different timezones
---
.../controllers/content.event.controller.js | 4 ++++
widget/controllers/widget.home.controller.js | 20 +++++++++++++++++++
widget/index.html | 11 +++++++---
widget/templates/Event_Item_2.html | 10 +++++++---
widget/templates/Event_Item_3.html | 15 ++++++++------
widget/templates/Event_Item_4.html | 11 ++++++----
6 files changed, 55 insertions(+), 16 deletions(-)
diff --git a/control/content/controllers/content.event.controller.js b/control/content/controllers/content.event.controller.js
index 3fc8e09..2f2d8f4 100644
--- a/control/content/controllers/content.event.controller.js
+++ b/control/content/controllers/content.event.controller.js
@@ -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) {
diff --git a/widget/controllers/widget.home.controller.js b/widget/controllers/widget.home.controller.js
index 2f410ba..98c7aa5 100644
--- a/widget/controllers/widget.home.controller.js
+++ b/widget/controllers/widget.home.controller.js
@@ -358,6 +358,26 @@
else return new Date(event.data.startDate);
}
+ $scope.startTimeToShow = function (event) {
+ 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.
*/
diff --git a/widget/index.html b/widget/index.html
index 826ee8e..39dff56 100644
--- a/widget/index.html
+++ b/widget/index.html
@@ -92,11 +92,16 @@ {{dateToShow(event) | getDate}}
{{event.data.title}}
-
- {{event.data.startTime | date: "hh:mm a"}} - {{event.data.endTime | date: "hh:mm a"}}
+
+
+ {{event.data.startTime | date: "hh:mm a"}} - {{event.data.endTime | date: "hh:mm a"}}
+
+
+ {{startTimeToShow(event) | date: "hh:mm a"}} - {{endTimeToShow(event) | date: "hh:mm a"}}
+
{{event.data.startTime && (event.data.startTime | getTimeZone) || ""}}
- All Day
+ All Day
diff --git a/widget/templates/Event_Item_2.html b/widget/templates/Event_Item_2.html
index 376d83e..8e0eb67 100644
--- a/widget/templates/Event_Item_2.html
+++ b/widget/templates/Event_Item_2.html
@@ -26,12 +26,16 @@
{{WidgetEvent.event.data.title}}
+ 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) || ""}}
- All Day
+ 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) || ""}}
+
+ All Day
diff --git a/widget/templates/Event_Item_3.html b/widget/templates/Event_Item_3.html
index 8d757ab..231c997 100644
--- a/widget/templates/Event_Item_3.html
+++ b/widget/templates/Event_Item_3.html
@@ -25,12 +25,15 @@
{{WidgetEvent.event.data.title}}
- {{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) || ""}}
-
- All Day
+ 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) || ""}}
+
+ {{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) || ""}}
+ All Day
diff --git a/widget/templates/Event_Item_4.html b/widget/templates/Event_Item_4.html
index 147cfb0..bf3f2fe 100644
--- a/widget/templates/Event_Item_4.html
+++ b/widget/templates/Event_Item_4.html
@@ -24,12 +24,15 @@
{{WidgetEvent.event.data.startDate |
{{WidgetEvent.event.data.title}}
+ 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) || ""}}
-
- All Day
+
+ {{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) || ""}}
+
All Day
From 10cdd1cf3e329677a791cfdc6272d24bbcc00b10 Mon Sep 17 00:00:00 2001
From: alaa smadi
Date: Thu, 5 Sep 2024 01:34:03 +0200
Subject: [PATCH 2/2] fix(eventDate): handle expand all events
handle expand all calendarevents
---
widget/controllers/widget.home.controller.js | 3 +++
1 file changed, 3 insertions(+)
diff --git a/widget/controllers/widget.home.controller.js b/widget/controllers/widget.home.controller.js
index 98c7aa5..a34de83 100644
--- a/widget/controllers/widget.home.controller.js
+++ b/widget/controllers/widget.home.controller.js
@@ -359,6 +359,9 @@
}
$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) {