mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 15:19:35 +02:00
parent
4d3cbe9ed7
commit
f796337ce1
1 changed files with 8 additions and 5 deletions
|
@ -27,16 +27,19 @@ const parseWarning = (profile, w, icons) => {
|
||||||
const icon = 'number' === typeof w.icoX && icons[w.icoX] || null
|
const icon = 'number' === typeof w.icoX && icons[w.icoX] || null
|
||||||
const type = icon && icon.res && typesByIcon[icon.res] || 'warning'
|
const type = icon && icon.res && typesByIcon[icon.res] || 'warning'
|
||||||
|
|
||||||
return {
|
const res = {
|
||||||
type,
|
type,
|
||||||
summary: brToNewline(w.head),
|
summary: brToNewline(w.head),
|
||||||
text: brToNewline(w.text),
|
text: brToNewline(w.text),
|
||||||
priority: w.prio,
|
priority: w.prio,
|
||||||
category: w.cat, // todo: parse to sth meaningful
|
category: w.cat || null // 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()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
module.exports = parseWarning
|
||||||
|
|
Loading…
Add table
Reference in a new issue