Skip to content

Comments

Add minimal granularity support to CalendarView for Month/Year Picker controls#875

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/improve-calendar-view-granularity
Draft

Add minimal granularity support to CalendarView for Month/Year Picker controls#875
Copilot wants to merge 3 commits intomainfrom
copilot/improve-calendar-view-granularity

Conversation

Copy link
Contributor

Copilot AI commented Feb 7, 2026

CalendarView lacked granularity control, preventing its use as a Month or Year picker. When navigating the hierarchy (Century → Decade → Year → Month → Day), it always required drilling down to day selection.

Changes

  • New CalendarMinimalGranularity enum: Day, Month, Year
  • New MinimalGranularity property on CalendarView: Defaults to Day for backward compatibility
  • Modified OnYearItemSelected behavior: Raises DateSelected event when reaching minimal granularity instead of continuing navigation
    • Year granularity: Selects DateTime(year, 1, 1) when clicking year in Decade view
    • Month granularity: Selects DateTime(year, month, 1) when clicking month in Year view

Usage

// Month Picker
var calendarView = new CalendarView 
{ 
    Mode = CalendarViewMode.Year,
    MinimalGranularity = CalendarMinimalGranularity.Month
};
calendarView.DateSelected += (s, e) => 
{
    // e.Date contains DateTime(year, month, 1)
};

// Year Picker
var calendarView = new CalendarView 
{ 
    Mode = CalendarViewMode.Decade,
    MinimalGranularity = CalendarMinimalGranularity.Year
};
calendarView.DateSelected += (s, e) => 
{
    // e.Date contains DateTime(year, 1, 1)
};

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • av-build-tel-api-v1.avaloniaui.net
    • Triggering command: /usr/share/dotnet/dotnet dotnet exec --runtimeconfig /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.1/tools/netstandard2.0/runtimeconfig.json /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.1/tools/netstandard2.0/Avalonia.BuildServices.Collector.dll (dns block)
    • Triggering command: /usr/share/dotnet/dotnet dotnet exec --runtimeconfig /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.1/tools/netstandard2.0/runtimeconfig.json /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.1/tools/netstandard2.0/Avalonia.BuildServices.Collector.dll 0 -j ACCEPT (dns block)
    • Triggering command: /usr/share/dotnet/dotnet dotnet exec --runtimeconfig /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.1/tools/netstandard2.0/runtimeconfig.json /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.1/tools/netstandard2.0/Avalonia.BuildServices.Collector.dll re re (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Improve Ursa CalendarView</issue_title>
<issue_description>CalendarView should have a property describing the minimal granularity, for example mark it as "month" or year, then it can be used to select a month or a year. This is to support future controls like "Month Picker" and "Year Picker"

to support this, the OnYearItemSelected method should property handle these cases. when it reaches minimal granularity, select the date with day=1 or month=1 and day=1

</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits February 7, 2026 10:38
Co-authored-by: rabbitism <14807942+rabbitism@users.noreply.github.com>
Co-authored-by: rabbitism <14807942+rabbitism@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve CalendarView with minimal granularity support Add minimal granularity support to CalendarView for Month/Year Picker controls Feb 7, 2026
Copilot AI requested a review from rabbitism February 7, 2026 10:44
@github-actions
Copy link

github-actions bot commented Feb 7, 2026

Code Coverage

Package Line Rate Branch Rate Complexity Health
Ursa 41% 31% 9051
Ursa.Themes.Semi 61% 68% 1021
Summary 49% (10700 / 21989) 34% (2644 / 7745) 10072

@github-actions
Copy link

github-actions bot commented Feb 7, 2026

Test Results

718 tests  +3   718 ✅ +3   19s ⏱️ +4s
  2 suites ±0     0 💤 ±0 
  2 files   ±0     0 ❌ ±0 

Results for commit 9d9de3d. ± Comparison against base commit 13362d6.

@rabbitism rabbitism marked this pull request as ready for review February 7, 2026 15:46
@rabbitism rabbitism marked this pull request as draft February 10, 2026 04:36
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.

Improve Ursa CalendarView

2 participants