Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for broadcast calendar #2597

Merged
merged 12 commits into from
Nov 23, 2024
Merged

Conversation

Nradar
Copy link
Contributor

@Nradar Nradar commented Nov 21, 2024

Broadcast Calendar Support

Overview

This pull request introduces support for the Broadcast Calendar feature in the DayPicker component. The Broadcast Calendar is designed to accommodate specific scheduling needs, particularly in broadcasting and media contexts, where weeks may not align with traditional calendar weeks.

Key Changes

  1. Broadcast Calendar Prop:

    • Added a new prop broadcastCalendar to the DayPicker component, allowing users to enable the Broadcast Calendar functionality.
  2. Date Calculations:

    • Implemented helper functions getBroadcastStartDate and getBroadcastEndDate in getBroadcastCalendar to calculate the start and end dates of the broadcast weeks based on the first day of the month.
    • Adjusted the logic in the getMonths function to utilize these new helper functions when broadcastCalendar is true.
  3. UI Integration:

    • Updated the DayPicker component to conditionally render the calendar based on the broadcastCalendar prop, ensuring that the UI reflects the correct week structure.
  4. Documentation:

    • Updated the documentation to include details about the new broadcastCalendar prop, including examples of how to use it in the DayPicker component.
  5. Localization Support:

    • Ensured that the Broadcast Calendar feature respects localization settings, allowing for proper display in different languages and regions.

More information about broadcast calendar, please refer to https://en.wikipedia.org/wiki/Broadcast_calendar

@gpbl
Copy link
Owner

gpbl commented Nov 22, 2024

That’s an interesting idea, @Nradar. Thanks for proposing it. I wasn’t aware of such calendars before.

@Nradar
Copy link
Contributor Author

Nradar commented Nov 22, 2024

That’s an interesting idea, @Nradar. Thanks for proposing it. I wasn’t aware of such calendars before.

Thank you for your feedback! The broadcast calendar is what my company uses for scheduling, so I thought it might be helpful to others as well. I hope the pull request meets the project’s needs, and I’m happy to make any changes if needed to get it approved. 😊

gpbl
gpbl previously approved these changes Nov 23, 2024
Copy link
Owner

@gpbl gpbl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Nradar, this looks great! Thanks for your efforts. I’ve updated the function names and other things to align with our conventions.

There are a few improvements that need to be made to the tests. I can address these personally in another pull request.

@gpbl gpbl merged commit 6833704 into gpbl:main Nov 23, 2024
10 checks passed
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.

2 participants