Adding log to custom dayjs wrapper

This commit is contained in:
Collin Duncan 2023-02-10 14:35:25 +01:00
parent 5edf0eac68
commit fb817610e6
No known key found for this signature in database

View file

@ -3,6 +3,7 @@ import isSameOrBefore from 'dayjs/plugin/isSameOrBefore'
import utc from 'dayjs/plugin/utc' import utc from 'dayjs/plugin/utc'
import timezone from 'dayjs/plugin/timezone' import timezone from 'dayjs/plugin/timezone'
import 'dayjs/locale/nl' import 'dayjs/locale/nl'
import { asyncLocalStorage } from './logger'
dayjs.extend(isSameOrBefore) dayjs.extend(isSameOrBefore)
dayjs.extend(utc) dayjs.extend(utc)
@ -14,6 +15,7 @@ dayjs.tz.setDefault('Europe/Amsterdam')
const dayjsTz = ( const dayjsTz = (
date?: string | number | Date | dayjs.Dayjs | null | undefined date?: string | number | Date | dayjs.Dayjs | null | undefined
) => { ) => {
asyncLocalStorage.getStore()?.debug(`<dayjs> timezoning ${date}`)
return dayjs(date).tz() return dayjs(date).tz()
} }