mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 15:19:35 +02:00
16 lines
307 B
JavaScript
16 lines
307 B
JavaScript
'use strict'
|
|
|
|
const moment = require('moment-timezone')
|
|
|
|
const parseDateTime = (tz, date, time) => {
|
|
let offset = 0 // in days
|
|
if (time.length > 6) {
|
|
offset = +time.slice(0, -6)
|
|
time = time.slice(-6)
|
|
}
|
|
|
|
return moment.tz(date + 'T' + time, tz)
|
|
.add(offset, 'days')
|
|
}
|
|
|
|
module.exports = parseDateTime
|