Commit 7b96a680 authored by Volker Krause's avatar Volker Krause
Browse files

Handle English language MÁV ticket date formats

BUG: 444550
parent b4f6f86e
Pipeline #93956 skipped
......@@ -8,7 +8,7 @@ function parseTicket(pdf, node, triggerNode) {
const text = pdf.pages[triggerNode.location].text;
var idx = 0;
while (true) {
var trip = text.substr(idx).match(/(\d{4}\.\d{2}\.\d{2})\. *(\d{2}:\d{2}) *(.*) *-> *(.*) *(\d{2}:\d{2}) *(.*) *(\d)\./);
var trip = text.substr(idx).match(/(\d{2,4}\.\d{2}\.\d{2,4})\. *(\d{2}:\d{2}) *(.*) *-> *(.*) *(\d{2}:\d{2}) *(.*) *(\d)\./);
if (!trip) {
break;
}
......@@ -16,8 +16,8 @@ function parseTicket(pdf, node, triggerNode) {
var res = JsonLd.newTrainReservation();
res.reservationFor.departureStation.name = trip[3];
res.reservationFor.arrivalStation.name = trip[4];
res.reservationFor.departureTime = JsonLd.toDateTime(trip[1] + trip[2], "yyyy.MM.ddhh:mm", "hu");
res.reservationFor.arrivalTime = JsonLd.toDateTime(trip[1] + trip[5], "yyyy.MM.ddhh:mm", "hu");
res.reservationFor.departureTime = JsonLd.toDateTime(trip[1] + trip[2], ["yyyy.MM.ddhh:mm", "dd.MM.yyyyhh:mm"], "hu");
res.reservationFor.arrivalTime = JsonLd.toDateTime(trip[1] + trip[5], ["yyyy.MM.ddhh:mm", "dd.MM.yyyyhh:mm"], "hu");
res.reservationFor.trainNumber = trip[6];
res.reservedTicket.ticketedSeat.seatingType = trip[7];
res.reservedTicket.ticketToken = "pdf417bin:" + Barcode.toBase64(triggerNode.content);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment