mirror of
https://github.com/dwaxweiler/connector-mobilizon
synced 2025-06-05 21:59:25 +02:00
remove unneeded folder
This commit is contained in:
42
source/front/formatter.js
Normal file
42
source/front/formatter.js
Normal file
@ -0,0 +1,42 @@
|
||||
import DateTimeWrapper from './date-time-wrapper'
|
||||
|
||||
export default class Formatter {
|
||||
static formatDate({ locale, timeZone, start, end, isShortOffsetNameShown }) {
|
||||
const startDateTime = new DateTimeWrapper({
|
||||
locale,
|
||||
text: start,
|
||||
timeZone,
|
||||
})
|
||||
const endDateTime = new DateTimeWrapper({ locale, text: end, timeZone })
|
||||
let dateText = startDateTime.getShortDate()
|
||||
dateText += ' ' + startDateTime.get24Time()
|
||||
if (!startDateTime.equalsDate(endDateTime)) {
|
||||
if (isShortOffsetNameShown) {
|
||||
dateText += ' (' + startDateTime.getShortOffsetName() + ')'
|
||||
}
|
||||
dateText += ' - '
|
||||
dateText += endDateTime.getShortDate() + ' '
|
||||
} else {
|
||||
dateText += ' - '
|
||||
}
|
||||
dateText += endDateTime.get24Time()
|
||||
if (isShortOffsetNameShown) {
|
||||
dateText += ' (' + endDateTime.getShortOffsetName() + ')'
|
||||
}
|
||||
return dateText
|
||||
}
|
||||
|
||||
static formatLocation({ description, locality }) {
|
||||
let location = ''
|
||||
if (description) {
|
||||
location += description
|
||||
}
|
||||
if (location && locality) {
|
||||
location += ', '
|
||||
}
|
||||
if (locality) {
|
||||
location += locality
|
||||
}
|
||||
return location
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user