let luxon take zone from string

This commit is contained in:
Daniel Waxweiler 2021-05-05 10:13:16 +02:00
parent bc86f8e7c9
commit 22c0b22b8e
4 changed files with 5 additions and 5 deletions

View File

@ -8,7 +8,7 @@ test('#getShortDate usual date', t => {
test('#get24Time usual time', t => {
const d = new DateTimeWrapper({ locale: 'en-GB', text: '2020-12-24T16:45:00Z' })
t.is(d.get24Time(), '17:45')
t.is(d.get24Time(), '16:45')
})
test('#equalsDate same date, different time', t => {

View File

@ -3,7 +3,7 @@ import { DateTime } from 'luxon'
export default class DateTimeWrapper {
constructor({ locale, text }) {
this.dateTime = DateTime.fromISO(text, { locale })
this.dateTime = DateTime.fromISO(text, { locale, setZone: true })
}
getShortDate() {

View File

@ -42,7 +42,7 @@ test('#displayEvents one event', t => {
t.is(list.children[1].childNodes[0].getAttribute('href'), 'b')
t.is(list.children[1].childNodes[0].childNodes[0].nodeValue, 'a')
t.is(list.children[1].childNodes[1].tagName, 'BR')
t.is(list.children[1].childNodes[2].nodeValue, '15/04/2021 12:30 - 17:30')
t.is(list.children[1].childNodes[2].nodeValue, '15/04/2021 10:30 - 15:30')
t.is(list.children[1].childNodes[3].tagName, 'BR')
t.is(list.children[1].childNodes[4].nodeValue, 'c, d')
})

View File

@ -3,12 +3,12 @@ import Formatter from './formatter'
test('#formatDate one date', t => {
const date = Formatter.formatDate({ locale: 'en-GB', start: '2021-04-15T10:30:00Z', end: '2021-04-15T15:30:00Z' })
t.is(date, '15/04/2021 12:30 - 17:30')
t.is(date, '15/04/2021 10:30 - 15:30')
})
test('#formatDate two dates', t => {
const date = Formatter.formatDate({ locale: 'en-GB', start: '2021-04-15T10:30:00Z', end: '2021-04-16T15:30:00Z' })
t.is(date, '15/04/2021 12:30 - 16/04/2021 17:30')
t.is(date, '15/04/2021 10:30 - 16/04/2021 15:30')
})
test('#formatLocation both parameters', t => {