@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.js CHANGED
@@ -221,12 +221,20 @@ function formatClassTime(cls) {
221
221
  const em = endTotal % 60;
222
222
  return `${h}:${cls.startTime.minutes}-${eh}:${String(em).padStart(2, "0")}`;
223
223
  }
224
+ function formatBookingLabel(cls) {
225
+ const price = cls.price;
226
+ const isFree = price === null || price === void 0 || `${price}` === "" || `${price}` === "0";
227
+ return isFree ? "Book for free" : `Book for ${cls.currency ?? ""} ${price}`.trim();
228
+ }
224
229
  function getBookingsOnDate(cls, date) {
225
230
  if (!cls.bookings?.length) return 0;
226
- const ds = date.toISOString().split("T")[0];
231
+ const target = new Date(date);
232
+ target.setHours(0, 0, 0, 0);
227
233
  return cls.bookings.filter((b) => {
228
234
  try {
229
- return new Date(b.classDate).toISOString().split("T")[0] === ds;
235
+ const bookingDate = new Date(b.classDate);
236
+ bookingDate.setHours(0, 0, 0, 0);
237
+ return bookingDate.getTime() === target.getTime();
230
238
  } catch {
231
239
  return false;
232
240
  }
@@ -530,7 +538,7 @@ function ScheduleView({ schedule, dates, selectedIdx, onSelectDate, onOpenModal
530
538
  if (!cls.id) return;
531
539
  onOpenModal?.(isFull ? "waitlist" : "book", cls.id, selectedDate);
532
540
  },
533
- children: isFull ? "Join Waitlist" : "Book Now"
541
+ children: isFull ? "Join Waitlist" : formatBookingLabel(cls)
534
542
  }
535
543
  )
536
544
  ] })