@asd20/ui 3.2.810 → 3.2.812
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
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
<asd20-modal
|
|
3
3
|
v-if="event"
|
|
4
4
|
:open="open"
|
|
5
|
-
:title="
|
|
6
|
-
`${event.calendarOrganizationTitle || event.calendarLocation} Event`
|
|
7
|
-
"
|
|
5
|
+
:title="`${event.calendarOrganizationTitle || event.calendarLocation} Event`"
|
|
8
6
|
icon="calendar-alt"
|
|
9
7
|
dismissable
|
|
10
8
|
class="asd20-event-modal"
|
|
@@ -23,7 +21,7 @@
|
|
|
23
21
|
</header>
|
|
24
22
|
<Asd20List class="description">
|
|
25
23
|
<Asd20ListItem
|
|
26
|
-
v-if="time"
|
|
24
|
+
v-if="time !== null"
|
|
27
25
|
icon="hours-alt"
|
|
28
26
|
icon-size="lg"
|
|
29
27
|
label="Time"
|
|
@@ -55,18 +53,12 @@
|
|
|
55
53
|
</template>
|
|
56
54
|
|
|
57
55
|
<script>
|
|
58
|
-
// import parse from 'date-fns/parse'
|
|
59
|
-
// import Vue from 'vue'
|
|
60
|
-
|
|
61
|
-
import { truncate } from 'lodash-es'
|
|
62
56
|
import { format, parse } from 'date-fns'
|
|
63
57
|
import Asd20Modal from '../../molecules/Asd20Modal'
|
|
64
58
|
import Asd20Tag from '../../atoms/Asd20Tag'
|
|
65
59
|
import Asd20List from '../../organisms/Asd20List'
|
|
66
60
|
import Asd20ListItem from '../../molecules/Asd20ListItem'
|
|
67
61
|
import Asd20Viewport from '../../atoms/Asd20Viewport'
|
|
68
|
-
// import VScrollLock from 'v-scroll-lock'
|
|
69
|
-
// Vue.use(VScrollLock)
|
|
70
62
|
|
|
71
63
|
export default {
|
|
72
64
|
name: 'Asd20EventModal',
|
|
@@ -81,32 +73,37 @@ export default {
|
|
|
81
73
|
},
|
|
82
74
|
|
|
83
75
|
time() {
|
|
84
|
-
if (!this.event) return
|
|
76
|
+
if (!this.event) return null
|
|
85
77
|
|
|
86
|
-
|
|
78
|
+
const startTime = parse(this.event.start, "yyyy-MM-dd'T'HH:mm:ssX", new Date())
|
|
79
|
+
const endTime = parse(this.event.end, "yyyy-MM-dd'T'HH:mm:ssX", new Date())
|
|
87
80
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
)}<br>ending ${format(
|
|
93
|
-
parse(this.event.end),
|
|
94
|
-
'<b>h:mm aa</b>, dddd, MMMM DD, YYYY'
|
|
95
|
-
)}`
|
|
81
|
+
const startHour = startTime.getHours()
|
|
82
|
+
// Display 'TBD' if start time is the same as end time and falls between 11 PM and 3 AM
|
|
83
|
+
if (startTime.getTime() === endTime.getTime() && (startHour >= 23 || startHour < 3)) {
|
|
84
|
+
return 'TBD'
|
|
96
85
|
}
|
|
97
86
|
|
|
98
|
-
let time = `${format(
|
|
99
|
-
|
|
100
|
-
|
|
87
|
+
let time = `${format(startTime, '<b>h:mm aa</b>').replace(/:00/g, '')}`
|
|
88
|
+
|
|
89
|
+
// Check if end time is the same as start time
|
|
90
|
+
if (startTime.getTime() === endTime.getTime()) {
|
|
91
|
+
time += '' // No end time needed if they are the same
|
|
92
|
+
} else if (this.event.endTimeUndetermined) {
|
|
93
|
+
time += `${format(endTime).replace(/:00/g, '')}`
|
|
101
94
|
} else {
|
|
102
|
-
time += ` - ${format(
|
|
95
|
+
time += ` - ${format(endTime, '<b>h:mm aa</b>')
|
|
96
|
+
.replace(/#/g, ' ')
|
|
97
|
+
.replace(/:00/g, '')}`
|
|
103
98
|
}
|
|
99
|
+
|
|
104
100
|
return time
|
|
105
101
|
},
|
|
106
102
|
},
|
|
107
103
|
}
|
|
108
104
|
</script>
|
|
109
105
|
|
|
106
|
+
|
|
110
107
|
<style lang="scss" scoped>
|
|
111
108
|
@import '../../../design/_mixins.scss';
|
|
112
109
|
@import '../../../design/_variables.scss';
|
|
@@ -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
|
+
|