mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-03 06:27:11 +01:00
daysbooked in timezone Europe/Berlin
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { parse, format, addDays } from 'date-fns'
|
||||
import { utcToZonedTime } from 'date-fns-tz'
|
||||
|
||||
const FRONTEND_FORMAT = 'dd.MM.yyyy'
|
||||
const BACKEND_FORMAT = 'yyyy-MM-dd'
|
||||
@@ -66,3 +67,8 @@ function dateParse(input: string, formatString: string) {
|
||||
export function dateParseFrontend(input: string) {
|
||||
return dateParse(input, FRONTEND_FORMAT)
|
||||
}
|
||||
|
||||
export function nowInTz(timezone = 'Europe/Berlin') {
|
||||
const now = new Date()
|
||||
return utcToZonedTime(now, timezone)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user