(tense, event, start, end)
| 63 | } |
| 64 | |
| 65 | function buildEventDOM(tense, event, start, end) { |
| 66 | const durationFormat = { |
| 67 | weekday: 'short', |
| 68 | hour : '2-digit', |
| 69 | minute : '2-digit' |
| 70 | }; |
| 71 | const relativeTime = tense === 'now' ? 'NOW' : getRelativeTime(now, start); |
| 72 | const duration = start.toLocaleTimeString([], durationFormat) + ' - ' + end.toLocaleTimeString([], durationFormat); |
| 73 | |
| 74 | let location = ''; |
| 75 | if (calendar.showLocation && event.location) { |
| 76 | location = `<span class="event-location event-details">${event.location}</span>`; |
| 77 | } |
| 78 | let description = ''; |
| 79 | if (event.description) { |
| 80 | description = `<span class="event-description event-details">${event.description}</span>`; |
| 81 | } |
| 82 | |
| 83 | const eventContent = `<section class="event event-${tense}"> |
| 84 | <h2 class="event-summary"> |
| 85 | ${event.summary} |
| 86 | <span class="event-relative-time">${relativeTime}</span> |
| 87 | </h2> |
| 88 | ${location} |
| 89 | <span class="event-duration event-details">${duration}</span> |
| 90 | ${description} |
| 91 | </section>`; |
| 92 | return eventContent; |
| 93 | } |
| 94 | |
| 95 | function fetchData() { |
| 96 | const eventList = document.querySelector('.event-list'); |
no test coverage detected