Skip to content

Support for Custom Week Number Calculation #308

@PekingSpades

Description

@PekingSpades

Feature Request: Support for Custom Week Number Calculation

Is your feature suggestion related to a problem? Please describe.
The current WeekView implementation only supports standard ISO week numbering, which starts from the first week of January. This limitation is problematic for applications that need to display custom calendar systems, such as:

  • Academic calendars where the academic year starts in September
  • Fiscal year calendars that don't align with the calendar year
  • Custom organizational calendars with specific start dates

Currently, there's no way to customize how week numbers are calculated, making the library unsuitable for these use cases.

Describe the solution you'd like
Add support for custom week number calculation by introducing a beginWeekCalendar property in WeekView. This property would accept a Calendar object representing the start date from which week numbers should be calculated. When set, the week numbers displayed in the header would be calculated from this custom start date rather than from the beginning of the calendar year.

For example:

  • If beginWeekCalendar is set to September 1st, 2024, then September 1-7 would be displayed as "Week 1"
  • The week numbers would increment from this custom start date

Describe alternatives you've considered

  1. Forking and modifying the library: This requires maintaining a separate fork and missing out on future updates
  2. Post-processing the displayed week numbers: This would be hacky and wouldn't integrate well with the library's internal logic
  3. Using a different calendar library: Would require significant migration effort for existing users

Additional context
This feature would be particularly useful for educational institutions and businesses that operate on non-standard calendar cycles. The implementation should:

  • Be backward compatible (when beginWeekCalendar is null, use the default week numbering)
  • Use the standard Calendar API for better compatibility with older Android versions (avoiding Java 8 time API)
  • Be easily configurable through the WeekView's public API

The proposed implementation maintains full backward compatibility while adding this valuable flexibility for custom calendar systems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions