handle warnings without schedule sDate/eDate/lModDate 🐛

closes #78
This commit is contained in:
Jannis R 2018-08-24 20:16:23 +02:00
parent 4d3cbe9ed7
commit f796337ce1
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5

View file

@ -27,16 +27,19 @@ const parseWarning = (profile, w, icons) => {
const icon = 'number' === typeof w.icoX && icons[w.icoX] || null
const type = icon && icon.res && typesByIcon[icon.res] || 'warning'
return {
const res = {
type,
summary: brToNewline(w.head),
text: brToNewline(w.text),
priority: w.prio,
category: w.cat, // todo: parse to sth meaningful
validFrom: parseDateTime(profile, w.sDate, w.sTime).toISO(),
validUntil: parseDateTime(profile, w.eDate, w.eTime).toISO(),
modified: parseDateTime(profile, w.lModDate, w.lModTime).toISO()
category: w.cat || null // todo: parse to sth meaningful
}
if (w.sDate && w.sTime) res.validFrom = parseDateTime(profile, w.sDate, w.sTime).toISO()
if (w.eDate && w.eTime) res.validUntil = parseDateTime(profile, w.eDate, w.eTime).toISO()
if (w.lModDate && w.lModTime) res.modified = parseDateTime(profile, w.lModDate, w.lModTime).toISO()
return res
}
module.exports = parseWarning