mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-04-20 23:23:56 +03:00
parseDateTime, format{Date,Time}: share Luxon IANAZones ⚡️
This commit is contained in:
parent
fc1afe0625
commit
547dd4b2a9
4 changed files with 9 additions and 6 deletions
|
@ -1,6 +1,5 @@
|
|||
import {DateTime, IANAZone} from 'luxon'
|
||||
|
||||
const timezones = new WeakMap()
|
||||
import {luxonIANAZonesByProfile as timezones} from '../lib/luxon-timezones.js'
|
||||
|
||||
// todo: change to `(profile) => (when) => {}`
|
||||
const formatDate = (profile, when) => {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import {DateTime, IANAZone} from 'luxon'
|
||||
|
||||
const timezones = new WeakMap()
|
||||
import {luxonIANAZonesByProfile as timezones} from '../lib/luxon-timezones.js'
|
||||
|
||||
// todo: change to `(profile) => (when) => {}`
|
||||
const formatTime = (profile, when) => {
|
||||
|
|
6
lib/luxon-timezones.js
Normal file
6
lib/luxon-timezones.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
// hafas-client profile -> luxon.IANAZone
|
||||
const luxonIANAZonesByProfile = new WeakMap()
|
||||
|
||||
export {
|
||||
luxonIANAZonesByProfile,
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
import {DateTime, FixedOffsetZone, IANAZone} from 'luxon'
|
||||
|
||||
const timezones = new WeakMap()
|
||||
import {luxonIANAZonesByProfile as timezones} from '../lib/luxon-timezones.js'
|
||||
|
||||
const parseDateTime = ({profile}, date, time, tzOffset = null, timestamp = false) => {
|
||||
const pDate = [date.substr(-8, 4), date.substr(-4, 2), date.substr(-2, 2)]
|
||||
|
|
Loading…
Add table
Reference in a new issue