File indexing completed on 2024-12-29 04:51:02

0001 /*
0002    SPDX-FileCopyrightText: 2019 Volker Krause <vkrause@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 function main(text) {
0008     var res = JsonLd.newBusReservation();
0009     res.reservationNumber = text.match(/Reference number +(\w+)\n/)[1];
0010     var date = text.match(/Outward - ([\d\/]+) /)[1];
0011     var dep = text.match(/Departing: ([\d:]+) (.*?)\n/);
0012     res.reservationFor.departureBusStop.name = dep[2];
0013     res.reservationFor.departureTime = JsonLd.toDateTime(date + dep[1], "dd/MM/yyyyhh:mm", "en");
0014     var arr = text.match(/Arriving: ([\d:]+) (.*?)\n/);
0015     res.reservationFor.arrivalBusStop.name = arr[2];
0016     res.reservationFor.arrivalTime = JsonLd.toDateTime(date + arr[1], "dd/MM/yyyyhh:mm", "en");
0017 
0018     return res;
0019 }