tripstorekrabi-shared 1.6.5 → 1.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/utils.js +4 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tripstorekrabi-shared",
3
- "version": "1.6.5",
3
+ "version": "1.6.6",
4
4
  "description": "Shared library for Trip Store Krabi",
5
5
  "author": "Stefan Sommer",
6
6
  "repository": {
package/utils.js CHANGED
@@ -307,7 +307,7 @@ export function getBookingSummary(booking, options = {}) {
307
307
  }
308
308
 
309
309
  if (booking.productDescription && booking.operator && booking.departureDate && booking.schedule && booking.leadTraveller) {
310
- let departureDate = dayjs(booking.departureDate.toDate()).format("DD.MM.YYYY");
310
+ let departureDate = dayjs(booking.departureDate.toDate()).tz("Asia/Bangkok").format("DD.MM.YYYY");
311
311
  summary += booking.productDescription + ", " + departureDate + ", " + booking.operator + ", " + booking.adults + ", " + booking.children + ", "
312
312
  + booking.infants + ", " + booking.leadTraveller;
313
313
 
@@ -438,10 +438,10 @@ export function validatePickupTime(pickupTime, schedule = "", context) {
438
438
  return checkTime(from, departureTime, context);
439
439
  }
440
440
  } else if (pickupTime.indexOf("-") != -1) {
441
- return context.createError({ message: `Invalid pickup time format, use spaces around the dash: ${pickupTime.replace(/ /g, '').replace("-", " - ")}` });
441
+ return context.createError({ message: `Invalid pickup time format, use spaces around the dash: ${pickupTime.replace(/ /g, '').replace("-", " - ")}`, path: context.path, });
442
442
  } else {
443
443
  if (!SCHEDULE_PATTERN.test(pickupTime)) {
444
- return context.createError({ message: "Invalid pickup time format: for example use '09:00' or '08:45 - 09:00'" });
444
+ return context.createError({ message: "Invalid pickup time format: for example use '09:00' or '08:45 - 09:00'", path: context.path, });
445
445
  } else {
446
446
  return checkTime(pickupTime, departureTime, context);
447
447
  }
@@ -460,7 +460,7 @@ function checkTime(pickupTimeValue, departureTimeValue, context) {
460
460
  let departureTimeValues = departureTimeValue.split(":");
461
461
  let departureTime = dayjs().hour(departureTimeValues[0]).minute(departureTimeValues[1]).second(0);
462
462
 
463
- return pickupTime.isSameOrBefore(departureTime) ? true : context.createError({ message: "Pickup time must be before or equals departure time" });
463
+ return pickupTime.isSameOrBefore(departureTime) ? true : context.createError({ message: "Pickup time must be before or equals departure time", path: context.path, });
464
464
  } catch (e) {
465
465
  return false;
466
466
  }