Skip to content

Commit

Permalink
Merge pull request #53 from frog-pond/remove-event-description-html
Browse files Browse the repository at this point in the history
Strip html from the event description
  • Loading branch information
hawkrives committed Aug 25, 2018
2 parents 4419697 + e90b6ce commit 5de1915
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion modules/node_modules/@frogpond/ccc-google-calendar/index.mjs
@@ -1,17 +1,21 @@
import {get} from '@frogpond/ccc-lib'
import moment from 'moment'
import _jsdom from 'jsdom'
const {JSDOM} = _jsdom

function convertGoogleEvents(data, now = moment()) {
let events = data.map(event => {
const startTime = moment(event.start.date || event.start.dateTime)
const endTime = moment(event.end.date || event.end.dateTime)
let description = (event.description || '').replace('<br>', '\n')
description = JSDOM.fragment(description).textContent.trim()

return {
dataSource: 'google',
startTime,
endTime,
title: event.summary || '',
description: event.description || '',
description: description,
location: event.location || '',
isOngoing: startTime.isBefore(now, 'day'),
config: {
Expand Down

0 comments on commit 5de1915

Please sign in to comment.