I tried to change it myself, but don’t know if it’s right (first time working with node.js).
I changed “two things” in calendar.coffee:
First:
! getNextEvents: (events, from, to) ->
result = []
_.forEach(events, (event) =>
if event.rrule?
duration = event.end.getTime() - event.start.getTime()
# include events, that are ongoing
fromRrule = new Date(from)
fromRrule.setTime(fromRrule.getTime() - duration)
# get recurring events
dates = event.rrule.between(fromRrule, to, true)
_.forEach(dates, (date) =>
# calculate end
end = new Date(date)
end.setTime(date.getTime()+duration)
#Before makes new begin time
if @timeOffset > 0
date = new date(date.getTime() + @timeOffset)
return date
#After makes new end time
if @timeOffset < 0
end = new Date(end.getTime() + @timeOffset)
return end
# add to result list
result.push({
start: date
end: end
event: event
})
)
And seconds:
! constructor: (@framework) ->
parsePredicate: (input, context) ->
field = null
fieldValue = null
checkType = null
timeOffset = 0
eventType = null
setField = (m, match) => field = match.trim()
setCheckType = (m, match) => checkType = match.trim()
setFieldValue = (m, match) => fieldValue = match.trim()
setEventType = (m, match) => eventType = match.trim()
m = M(input, context)
.match('calendar event with ')
.match(['title ', 'description '], setField)
.match(['contains ', 'equals '], setCheckType)
.matchString(setFieldValue)
.match(['before ', 'after ‘], optional: yes, (m, match) => modifier = match.trim())
.match([‘it ‘], optional: yes)
.optional( (m) =>
next = m
m.matchTimeDuration((m, tp) =>
m.match([’ before ‘, ’ after ‘], (m, match) =>
next = m
timeOffset = tp.timeMs
if match.trim() is "before"
timeOffset = -timeOffset
)
)
return next
)
.match([’ starts’, ’ ends’, ’ takes place’], setEventType)
and a rule for example: If calendar event with title|description contains|equals “some text” 30 minutes before|after it starts|ends|takes place
Ps. Sorry about the bad Engels.