Commit ea266977 authored by Volker Krause's avatar Volker Krause
Browse files

Slightly stricter date/time matching patterns

This got confused by transfer times of more than one hour, which are
stated between legs here and match the same pattern.
parent 5a8d6e65
Pipeline #199464 passed with stage
in 3 minutes and 51 seconds
......@@ -80,7 +80,7 @@ function parseInouiPdfText(page)
return reservations;
var pos = date.index + date[0].length;
while (true) {
var dep = text.substr(pos).match(/(\d+[h:]\d+) +(.*)\n/);
var dep = text.substr(pos).match(/(\d{2}[h:]\d{2}) +(.*)\n/);
if (!dep)
break;
pos += dep.index + dep[0].length;
......@@ -89,7 +89,7 @@ function parseInouiPdfText(page)
res.reservationFor.departureTime = JsonLd.toDateTime(date[1] + dep[1], ["d MMMM yyyyhh'h'mm", "dd MMMM yyyyhh:mm"], ["fr", "en"]);
res.reservationFor.departureStation.name = dep[2];
var arr = text.substr(pos).match(/(\d+[h:]\d+) +(.*)\n/);
var arr = text.substr(pos).match(/(\d{2}[h:]\d{2}) +(.*)\n/);
if (!arr)
break;
var endPos = arr.index + arr[0].length;
......
Supports Markdown
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