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

0001 /*
0002   SPDX-FileCopyrightText: 2023 Volker Krause <vkrause@kde.org>
0003   SPDX-License-Identifier: LGPL-2.0-or-later
0004 */
0005 
0006 function extractPkPass(pass) {
0007     let res = JsonLd.newLodgingReservation();
0008     res.reservationNumber = pass.field['booking-nr'].value;
0009     res.checkinTime = pass.relevantDate.toJSON();
0010     const depDate = pass.field['booking-date'].value.match(/ - (\d\d\.\d\d\.\d\d)/);
0011     const depTime = pass.field['back_reservation'].value.match(/Check-out:.* (\d\d:\d\d)/);
0012     res.checkoutTime = JsonLd.toDateTime(depDate[1] + ' ' + depTime[1], 'dd.MM.yy hh:mm', 'en');
0013     res.reservationFor.name = pass.field['hotel-name'].value;
0014     const addr = pass.field['back_hotel_contact'].value.split('\n');
0015     res.reservationFor.address.streetAddress = addr[1];
0016     res.reservationFor.address.addressLocality = addr[2];
0017     res.reservationFor.telephone = addr[4].match(/: (.*)/)[1];
0018     res.reservationFor.email = addr[3].match(/: (.*)/)[1];
0019     res.modifyReservationUrl = pass.field['back_booking_link'].value.match(/(https:.*?)>/)[1];
0020     return res;
0021 }