{crossResourceEvents.map((event) => (
{event.title} - {getEventResources(event).length} resources
))}
)
}
```
--------------------------------
### Resource Calendar Unit Test Example
Source: https://github.com/kcsujeet/ilamy-calendar/blob/main/docs/resource-calendar.md
A basic unit test to verify that events are correctly filtered and retrieved for a specific resource using the `useIlamyResourceCalendarContext` hook.
```typescript
describe('ResourceCalendar', () => {
it('should filter events by resource', () => {
const { getEventsForResource } = useIlamyResourceCalendarContext()
const roomAEvents = getEventsForResource('room-a')
expect(roomAEvents).toHaveLength(3)
})
})
```
--------------------------------
### Correctly Defining Start and End Dates for Recurrence Rules
Source: https://github.com/kcsujeet/ilamy-calendar/blob/main/docs/rrule.js.md
Illustrates the correct method for defining `dtstart` and `until` dates using UTC timestamps to avoid unexpected timezone offsets. Using `new Date()` directly can lead to incorrect results due to implicit timezone conversions.
```javascript
// WRONG: Will produce dates with TZ offsets added
new RRule({
freq: RRule.MONTHLY,
dtstart: new Date(2018, 1, 1, 10, 30),
until: new Date(2018, 2, 31),
}).all()[('2018-02-01T18:30:00.000Z', '2018-03-01T18:30:00.000Z')]
// RIGHT: Will produce dates with recurrences at the correct time
new RRule({
freq: RRule.MONTHLY,
dtstart: datetime(2018, 2, 1, 10, 30),
until: datetime(2018, 3, 31),
}).all()[('2018-02-01T10:30:00.000Z', '2018-03-01T10:30:00.000Z')]
```
--------------------------------
### IlamyResourceCalendar Month View Example
Source: https://github.com/kcsujeet/ilamy-calendar/blob/main/docs/resource-calendar.md
Renders the IlamyResourceCalendar in month view, displaying resources as rows and days as columns. Ensure 'resources' and 'events' props are provided.
```tsx