fix: pass recurring count value (#3844)

* fix: pass recurring count value

* fix: show dates for pending booking

Co-authored-by: Peer Richelsen <peeroke@gmail.com>
Co-authored-by: Leo Giovanetti <hello@leog.me>
This commit is contained in:
Udit Takkar
2022-08-27 10:12:38 -03:00
committed by GitHub
co-authored by Peer Richelsen Leo Giovanetti
parent cfe7c7a5b3
commit 944f4dc43b
2 changed files with 6 additions and 7 deletions
@@ -181,18 +181,13 @@ function BookingListItem(booking: BookingItemProps) {
// Calculate the booking date(s) and setup recurring event data to show
let recurringStrings: string[] = [];
let recurringDates: Date[] = [];
const today = new Date();
if (booking.recurringBookings && booking.eventType.recurringEvent?.freq !== undefined) {
[recurringStrings, recurringDates] = extractRecurringDates(
booking.recurringBookings,
user?.timeZone,
i18n
);
if (booking.status === BookingStatus.PENDING) {
// Only take into consideration next up instances if booking is confirmed
recurringDates = recurringDates.filter((aDate) => aDate >= today);
recurringStrings = recurringDates.map((_, key) => recurringStrings[key]);
}
}
const location = booking.location || "";
+5 -1
View File
@@ -608,7 +608,11 @@ export function RecurringBookings({
<>
{eventType.recurringEvent?.count && (
<span className="font-medium">
{getEveryFreqFor({ t, recurringEvent: eventType.recurringEvent })}
{getEveryFreqFor({
t,
recurringEvent: eventType.recurringEvent,
recurringCount: recurringBookings?.length ?? undefined,
})}
</span>
)}
{eventType.recurringEvent?.count &&