@ohhwells/bridge 0.1.33-next.38 → 0.1.33-next.39

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.
package/dist/index.cjs CHANGED
@@ -271,12 +271,20 @@ function formatClassTime(cls) {
271
271
  const em = endTotal % 60;
272
272
  return `${h}:${cls.startTime.minutes}-${eh}:${String(em).padStart(2, "0")}`;
273
273
  }
274
+ function formatBookingLabel(cls) {
275
+ const price = cls.price;
276
+ const isFree = price === null || price === void 0 || `${price}` === "" || `${price}` === "0";
277
+ return isFree ? "Book for free" : `Book for ${cls.currency ?? ""} ${price}`.trim();
278
+ }
274
279
  function getBookingsOnDate(cls, date) {
275
280
  if (!cls.bookings?.length) return 0;
276
- const ds = date.toISOString().split("T")[0];
281
+ const target = new Date(date);
282
+ target.setHours(0, 0, 0, 0);
277
283
  return cls.bookings.filter((b) => {
278
284
  try {
279
- return new Date(b.classDate).toISOString().split("T")[0] === ds;
285
+ const bookingDate = new Date(b.classDate);
286
+ bookingDate.setHours(0, 0, 0, 0);
287
+ return bookingDate.getTime() === target.getTime();
280
288
  } catch {
281
289
  return false;
282
290
  }
@@ -580,7 +588,7 @@ function ScheduleView({ schedule, dates, selectedIdx, onSelectDate, onOpenModal
580
588
  if (!cls.id) return;
581
589
  onOpenModal?.(isFull ? "waitlist" : "book", cls.id, selectedDate);
582
590
  },
583
- children: isFull ? "Join Waitlist" : "Book Now"
591
+ children: isFull ? "Join Waitlist" : formatBookingLabel(cls)
584
592
  }
585
593
  )
586
594
  ] })