mirror of
https://github.com/dwaxweiler/connector-mobilizon
synced 2025-06-05 21:59:25 +02:00
fix empty WordPress timezone_string option resulting in Invalid DateTime [#10]
This commit is contained in:
@@ -3,6 +3,12 @@ import { DateTime } from 'luxon'
|
||||
export default class DateTimeWrapper {
|
||||
|
||||
constructor({ locale = 'en-GB', text, timeZone = 'utc' } = {}) {
|
||||
if (!timeZone) {
|
||||
timeZone = 'utc'
|
||||
}
|
||||
if (timeZone.includes(':') && timeZone.substring(0, 3).toUpperCase() !== 'UTC') {
|
||||
timeZone = 'UTC' + timeZone
|
||||
}
|
||||
this.dateTime = DateTime.fromISO(text, { locale, zone: timeZone })
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user