Skip to content

Commit 58c39c3

Browse files
MatthewHerbstjquense
authored andcommitted
fix: support point-in-time events in the Agenda view (jquense#1246)
Some events may have the same date/time, and are meant to represent point-in-time events, such as deadlines. These are not all day events, but they also should not be represnted as `${startTime} - ${endTime}` since the values will be the same. This will cause an event that is not marked as all day, and where the start and end are equal, to show as: ```js // old `${startTime} - ${endTime}` // new `${startTime}` ```
1 parent 7aef31f commit 58c39c3

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

examples/events.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
const now = new Date()
2+
13
export default [
24
{
35
id: 0,
@@ -103,4 +105,10 @@ export default [
103105
start: new Date(new Date().setHours(new Date().getHours() - 3)),
104106
end: new Date(new Date().setHours(new Date().getHours() + 3)),
105107
},
108+
{
109+
id: 15,
110+
title: 'Point in Time Event',
111+
start: now,
112+
end: now,
113+
},
106114
]

src/Agenda.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,9 @@ class Agenda extends React.Component {
129129
let start = accessors.start(event)
130130

131131
if (!accessors.allDay(event)) {
132-
if (dates.eq(start, end, 'day')) {
132+
if (dates.eq(start, end)) {
133+
label = localizer.format(start, 'agendaTimeFormat')
134+
} else if (dates.eq(start, end, 'day')) {
133135
label = localizer.format({ start, end }, 'agendaTimeRangeFormat')
134136
} else if (dates.eq(day, start, 'day')) {
135137
label = localizer.format(start, 'agendaTimeFormat')

0 commit comments

Comments
 (0)