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

0001 /*
0002    SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
0003    SPDX-License-Identifier: LGPL-2.0-or-later
0004 */
0005 
0006 function parseBoardingPass(pdf, node, triggerNode) {
0007     var res = triggerNode.result[0];
0008     const page = pdf.pages[triggerNode.location];
0009     const timesText = page.textInRect(0.5, 0.5, 1, 1);
0010     const times = timesText.match(/\n(\d\d:\d\d)[\s\S]*?\n(\d\d:\d\d)[\s\S]*?\n(\d\d:\d\d)[\s\S]*?\n(\d\d:\d\d)/);
0011     res.reservationFor.boardingTime = JsonLd.toDateTime(times[2], "hh:mm", "en");
0012     res.reservationFor.departureTime = JsonLd.toDateTime(times[3], "hh:mm", "en");
0013     res.reservationFor.arrivalTime = JsonLd.toDateTime(times[4], "hh:mm", "en");
0014     return res;
0015 }