danheron / Heron.MudCalendar

Calendar component for MudBlazor
MIT License
149 stars 30 forks source link

Work Week view #121

Closed gabriuz closed 3 months ago

gabriuz commented 4 months ago

Hello,

I would like to use MudCalendar for work planning. Usually the work is done on work days only - excluding Saturday and Sunday, so we can save some horizontal space and display more data in a cell.

This feature request relates to a previous one: https://github.com/danheron/Heron.MudCalendar/issues/105

Though here I would like to get a fourth button (work week, customizable/translated) in addition to existing month, week, day views.

If that makes sense, I could contribute and make a pull request:

danheron commented 3 months ago

Sounds good. That would be great if you could do that and make a pull request.

gabriuz commented 3 months ago

Here's the pull request: https://github.com/danheron/Heron.MudCalendar/pull/128

Looking forward to your comments.

danheron commented 3 months ago

Thanks! That looks really good.

My only issue is with the new FirstDayOfWeek property. It defaults to Sunday, but in my culture Monday is the first day of week. So now I have the problem that the normal week view is starting on Sunday and the DatePicker also uses Sunday as the first day of week.

I think it would be better to make this property nullable and if null then use the current culture settings. This is how the DatePicker in MudBlazor works:

image

gabriuz commented 3 months ago

Hey, https://github.com/danheron/Heron.MudCalendar/pull/128/commits/59182922922225d2598a2cf2b5495ae957453029 fixed FirstDayOfWeek property - now it works as previously if unset. This fix also reverted some changes to old tests - that's nice.

danheron commented 3 months ago

Thanks for the updates, but I now have other problems:

  1. The DatePicker doesn't work anymore, when I click on it I get an error.
  2. There are build warnings:

image

The warnings are only in the Unit Tests so not really critical, but it would still be good to fix these warnings.

gabriuz commented 3 months ago

Sorry for broken DatePicker, fixed now and the warnings are gone. https://github.com/danheron/Heron.MudCalendar/pull/128/commits/6134b8f4bc4f8a52c56029426bd04cd0ed0062f6

danheron commented 3 months ago

Looks good!

digitaldirk commented 2 weeks ago

Hi thank you for this contribution,

In my case an offical week is sun-sat and a work week is mon-fri. (But some calendars show as sun-sat and some are mon-sun)

So with no configuration of the MudCalendar, the week view shows sun-sat which is correct but the work week view shows sun-thurs, which I expect to be mon-fri. If I set FirstDayOfWeek to monday then the work week is right mon-fri but the week is now mon-sun.

Could there be a FirstDayOfWorkWeek as well so I could achieve sun-sat for week and mon-fri for work week?

@gabriuz @danheron

gabriuz commented 2 weeks ago

Hi,

sure, if Dan agrees, I could prepare a PR with new FirstDayOfWorkWeek param.

danheron commented 2 weeks ago

Sounds good. That would be great if you could create a PR @gabriuz.

gabriuz commented 1 week ago

Hello,

here's the PR: https://github.com/danheron/Heron.MudCalendar/pull/169 Looking forward to your comments!