@@ -63,12 +63,12 @@ function transformTrainServices(input: any): TrainServices[] {
|
||||
uid: service?.uid,
|
||||
trainid: service?.trainid,
|
||||
operatorCode: service?.operatorCode || 'UK',
|
||||
platform: service?.platform || '',
|
||||
platformIsHidden: service?.platformIsHidden || '',
|
||||
serviceIsSupressed: service?.serviceIsSupressed || '',
|
||||
platform: service?.platform || '-',
|
||||
platformIsHidden: service?.platformIsHidden,
|
||||
serviceIsSupressed: service?.serviceIsSupressed,
|
||||
origin: transformLocation(service?.origin),
|
||||
destination: transformLocation(service?.destination),
|
||||
isCancelled: service?.isCancelled || '',
|
||||
isCancelled: service?.isCancelled,
|
||||
cancelReason: service?.cancelReason,
|
||||
delayReason: service?.delayReason,
|
||||
arrivalType: service?.arrivalType,
|
||||
@@ -80,6 +80,7 @@ function transformTrainServices(input: any): TrainServices[] {
|
||||
etd: transformUnspecifiedDateTime(service?.etd),
|
||||
atd: transformUnspecifiedDateTime(service?.atd),
|
||||
}
|
||||
Object.keys(trainService).forEach(key => trainService[key] === undefined && delete trainService[key]);
|
||||
output.push(trainService)
|
||||
}
|
||||
return output
|
||||
@@ -101,8 +102,11 @@ function transformLocation(input: any): ServiceLocation[] {
|
||||
return output
|
||||
}
|
||||
|
||||
function transformUnspecifiedDateTime(input: string): Date {
|
||||
function transformUnspecifiedDateTime(input: string): Date | undefined {
|
||||
console.debug(`staffStation.transformUnspecifiedDateTime running`)
|
||||
if (!input) {
|
||||
return undefined
|
||||
}
|
||||
const date = tz(input, "Europe/London");
|
||||
return date.toDate()
|
||||
}
|
||||
Reference in New Issue
Block a user