1
0
mirror of https://github.com/dwaxweiler/connector-mobilizon synced 2025-05-19 12:54:18 +02:00
2021-04-13 21:10:28 +02:00

32 lines
791 B
JavaScript

import DateTimeWrapper from './date-time-wrapper'
export default class Formatter {
static formatDate({ start, end }) {
const startDateTime = new DateTimeWrapper(start)
const endDateTime = new DateTimeWrapper(end)
let dateText = startDateTime.getShortDate()
dateText += ' ' + startDateTime.get24Time()
dateText += ' - '
if (!startDateTime.equalsDate(endDateTime)) {
dateText += endDateTime.getShortDate() + ' '
}
dateText += endDateTime.get24Time()
return dateText
}
static formatLocation({ description, locality }) {
let location = ''
if (description) {
location += description
}
if (location && locality) {
location += ', '
}
if (locality) {
location += locality
}
return location
}
}