mirror of
https://github.com/dwaxweiler/connector-mobilizon
synced 2025-02-16 11:41:24 +01:00
set locale for tests
This commit is contained in:
parent
eae2d422e0
commit
65b42ba1e7
@ -1,6 +1,10 @@
|
|||||||
import test from 'ava'
|
import test from 'ava'
|
||||||
import DateTimeWrapper from './date-time-wrapper'
|
import DateTimeWrapper from './date-time-wrapper'
|
||||||
|
|
||||||
|
test.before(() => {
|
||||||
|
DateTimeWrapper.setDefaultLocale('en-GB')
|
||||||
|
})
|
||||||
|
|
||||||
test('#getShortDate usual date', t => {
|
test('#getShortDate usual date', t => {
|
||||||
const d = new DateTimeWrapper('2020-12-24T16:45:00Z')
|
const d = new DateTimeWrapper('2020-12-24T16:45:00Z')
|
||||||
t.is(d.getShortDate(), '24/12/2020')
|
t.is(d.getShortDate(), '24/12/2020')
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { DateTime } from 'luxon'
|
import { DateTime, Settings } from 'luxon'
|
||||||
|
|
||||||
export default class DateTimeWrapper {
|
export default class DateTimeWrapper {
|
||||||
|
|
||||||
@ -23,6 +23,10 @@ export default class DateTimeWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static getCurrentDatetimeAsString() {
|
static getCurrentDatetimeAsString() {
|
||||||
return DateTime.local().toString()
|
return DateTime.now().toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
static setDefaultLocale(locale) {
|
||||||
|
Settings.defaultLocale = locale
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user