jdtcn / BlazorDateRangePicker

A Blazor component for choosing date ranges and dates
MIT License
182 stars 35 forks source link

Is there a way to select multiple single dates (while displaying more then one calendar)? #9

Closed jdtcn closed 4 years ago

jdtcn commented 4 years ago

But is there a way to select multiple single dates (while displaying more then one calendar)?

Originally posted by @mkopara in https://github.com/jdtcn/BlazorDateRangePicker/issues/6#issuecomment-590832972

jdtcn commented 4 years ago

@mkopara

But is there a way to select multiple single dates (while displaying more then one calendar)?

Yes, to achieve that you should use a different DateTimeOffset objects for a different picker instances.

Something like that:

<DateRangePicker StartDate="Start1" EndDate="Start1" SingleDatePicker="true"/>
<DateRangePicker StartDate="Start2" EndDate="Start2" SingleDatePicker="true"/>

@code {
    private DateTimeOffset? Start1 { get; set; } = DateTimeOffset.Now;
    private DateTimeOffset? Start2 { get; set; } = DateTimeOffset.Now;
}
mkopara commented 4 years ago

Not really the functionality I am aiming at.

How about this? calendar_multi_select

jdtcn commented 4 years ago

Probably that functionality can be achieved with an OnRangeSelect handler, and a custom CustomDateFunction that can apply a custom css class from a CustomDateClass property to the date. Just apply an active class to the dates you want.

mkopara commented 4 years ago

Is OnRangeSelect event fired on each date selected, or on range (two dates) selected?

Probably that functionality can be achieved with an OnRangeSelect handler, and a custom CustomDateFunction that can apply a custom css class from a CustomDateClass property to the date. Just apply an active class to the dates you want.

jdtcn commented 4 years ago

In the single date mode it fires on each selection.