@asd20/ui 3.2.810 → 3.2.811
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
"summary": "Parent Council - College Info Meeting",
|
|
84
84
|
"description": "Admissions officers from several local and regional colleges/universities will be in attendance sharing information about their schools.",
|
|
85
85
|
"location": "AAHS Media Center",
|
|
86
|
-
"start": "2023-01-
|
|
87
|
-
"end": "2023-01-
|
|
86
|
+
"start": "2023-01-19T08:20:00Z",
|
|
87
|
+
"end": "2023-01-19T08:20:00Z",
|
|
88
88
|
"dtstamp": "2023-01-19T20:20:00Z",
|
|
89
89
|
"class": "",
|
|
90
90
|
"priority": "",
|
|
@@ -1,3 +1,57 @@
|
|
|
1
|
+
// import format from 'date-fns/format'
|
|
2
|
+
// import parse from 'date-fns/parse'
|
|
3
|
+
|
|
4
|
+
// const formattedTime = event => {
|
|
5
|
+
// if (!event) return
|
|
6
|
+
|
|
7
|
+
// if (event.allDay) return 'All Day'
|
|
8
|
+
|
|
9
|
+
// if (event.multiDay) {
|
|
10
|
+
// return `${format(
|
|
11
|
+
// parse(event.originalStart),
|
|
12
|
+
// '<b>h:mm aa</b>, dddd, MMMM DD, YYYY'
|
|
13
|
+
// )
|
|
14
|
+
// .replace(/#/g, ' ')
|
|
15
|
+
// .replace(/:00/g, '')}<br>ending ${format(
|
|
16
|
+
// parse(event.end),
|
|
17
|
+
// '<b>h:mm aa</b>, dddd, MMMM DD, YYYY'
|
|
18
|
+
// )
|
|
19
|
+
// .replace(/#/g, ' ')
|
|
20
|
+
// .replace(/:00/g, '')}`
|
|
21
|
+
// }
|
|
22
|
+
|
|
23
|
+
// let time = `${format(parse(event.start), '<b>h:mm aa</b>').replace(
|
|
24
|
+
// /:00/g,
|
|
25
|
+
// ''
|
|
26
|
+
// )}`
|
|
27
|
+
// if (event.endTimeUndetermined) {
|
|
28
|
+
// time += `${format(parse(event.end)).replace(/:00/g, '')}`
|
|
29
|
+
// } else {
|
|
30
|
+
// time += ` - ${format(parse(event.end), '<b>h:mm aa</b>')
|
|
31
|
+
// .replace(/#/g, ' ')
|
|
32
|
+
// .replace(/:00/g, '')}`
|
|
33
|
+
// }
|
|
34
|
+
// return time
|
|
35
|
+
// }
|
|
36
|
+
|
|
37
|
+
// export default function mapEventToCard(event) {
|
|
38
|
+
// return {
|
|
39
|
+
// title: event.summary,
|
|
40
|
+
// // subtitle: 'Some subtitle goes here',
|
|
41
|
+
// description: event.description,
|
|
42
|
+
// categories: event.calendarCategories.concat([event.calendarName]),
|
|
43
|
+
// date: format(event.start),
|
|
44
|
+
// time: formattedTime(event),
|
|
45
|
+
// weekday: event.weekday,
|
|
46
|
+
// day: event.day,
|
|
47
|
+
// month: event.month,
|
|
48
|
+
// year: event.year,
|
|
49
|
+
// emphasizedDate: true,
|
|
50
|
+
// location: event.location || event.calendarLocation,
|
|
51
|
+
// isFeatured: event.isFeatured || event.isDistrictFeatured,
|
|
52
|
+
// }
|
|
53
|
+
// }
|
|
54
|
+
|
|
1
55
|
import format from 'date-fns/format'
|
|
2
56
|
import parse from 'date-fns/parse'
|
|
3
57
|
|
|
@@ -8,29 +62,39 @@ const formattedTime = event => {
|
|
|
8
62
|
|
|
9
63
|
if (event.multiDay) {
|
|
10
64
|
return `${format(
|
|
11
|
-
parse(event.originalStart),
|
|
12
|
-
'<b>h:mm aa</b>, dddd, MMMM
|
|
65
|
+
parse(event.originalStart, "yyyy-MM-dd'T'HH:mm:ssX", new Date()),
|
|
66
|
+
'<b>h:mm aa</b>, dddd, MMMM dd, yyyy'
|
|
13
67
|
)
|
|
14
68
|
.replace(/#/g, ' ')
|
|
15
69
|
.replace(/:00/g, '')}<br>ending ${format(
|
|
16
|
-
parse(event.end),
|
|
17
|
-
'<b>h:mm aa</b>, dddd, MMMM
|
|
70
|
+
parse(event.end, "yyyy-MM-dd'T'HH:mm:ssX", new Date()),
|
|
71
|
+
'<b>h:mm aa</b>, dddd, MMMM dd, yyyy'
|
|
18
72
|
)
|
|
19
73
|
.replace(/#/g, ' ')
|
|
20
74
|
.replace(/:00/g, '')}`
|
|
21
75
|
}
|
|
22
76
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
)
|
|
27
|
-
if (
|
|
28
|
-
|
|
77
|
+
const startTime = parse(event.start, "yyyy-MM-dd'T'HH:mm:ssX", new Date())
|
|
78
|
+
const endTime = parse(event.end, "yyyy-MM-dd'T'HH:mm:ssX", new Date())
|
|
79
|
+
// if start and end time are the same AND the start time is between 11pm and 3am, then set the start time as TBD and do not include an end time
|
|
80
|
+
const startHour = startTime.getHours()
|
|
81
|
+
if (startTime.getTime() === endTime.getTime() && (startHour >= 23 || startHour < 3)) {
|
|
82
|
+
return 'TBD'
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
let time = `${format(startTime, '<b>h:mm aa</b>').replace(/:00/g, '')}`
|
|
86
|
+
|
|
87
|
+
// Check if end time is the same as start time
|
|
88
|
+
if (startTime.getTime() === endTime.getTime()) {
|
|
89
|
+
time += '' // No end time needed if they are the same
|
|
90
|
+
} else if (event.endTimeUndetermined) {
|
|
91
|
+
time += `${format(endTime).replace(/:00/g, '')}`
|
|
29
92
|
} else {
|
|
30
|
-
time += ` - ${format(
|
|
93
|
+
time += ` - ${format(endTime, '<b>h:mm aa</b>')
|
|
31
94
|
.replace(/#/g, ' ')
|
|
32
95
|
.replace(/:00/g, '')}`
|
|
33
96
|
}
|
|
97
|
+
|
|
34
98
|
return time
|
|
35
99
|
}
|
|
36
100
|
|
|
@@ -40,7 +104,7 @@ export default function mapEventToCard(event) {
|
|
|
40
104
|
// subtitle: 'Some subtitle goes here',
|
|
41
105
|
description: event.description,
|
|
42
106
|
categories: event.calendarCategories.concat([event.calendarName]),
|
|
43
|
-
date: format(event.start),
|
|
107
|
+
date: format(parse(event.start, "yyyy-MM-dd'T'HH:mm:ssX", new Date())),
|
|
44
108
|
time: formattedTime(event),
|
|
45
109
|
weekday: event.weekday,
|
|
46
110
|
day: event.day,
|
|
@@ -51,3 +115,4 @@ export default function mapEventToCard(event) {
|
|
|
51
115
|
isFeatured: event.isFeatured || event.isDistrictFeatured,
|
|
52
116
|
}
|
|
53
117
|
}
|
|
118
|
+
|