Skip to content

Conversation

nomis52
Copy link

@nomis52 nomis52 commented Aug 25, 2025

Proposed change

This PR exposes the calendar days setting in the calendar card editor, allowing users to configure how many days of events to fetch. On calendars with many events, this improves performance if the number of days displayed is far fewer than 7.

This change also fixes the confusing date range logic. The current logic adds N days * 24hrs to now, which can result in events from more than N days.

Consider if it's currently midday on Monday, 2 days will fetch events up to midday on Wednesday, showing 3 days worth of events. The fixed logic fetches up to 2 calendar days of events, that is 11:59pm Tuesday.

Type of change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

type: custom:bubble-card
card_type: calendar
entities:
  ...
...
days: 2

Example printscreens/gif

Before , with days = 3
before

After change, days = 3
Screenshot 2025-08-25 at 4 24 14 PM

New editor field
Screenshot 2025-08-25 at 4 25 27 PM

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue or discussion:
  • Link to documentation pull request:

Additional documentation needed.

Users can now configure this limit in the editor

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests screenshots/gifs have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

  • Documentation added/updated for readme.

For large calendars with many events each day, setting this to a low
number will improve performance.
@nomis52 nomis52 changed the title Add the config parameter to limit the number of events fetched in the calendar card Expose the config parameter to limit the number of events fetched in the calendar card Aug 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant