Skip to content

Changes on TimePicker not being reflected. #112

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

Open
KikoCV opened this issue Mar 17, 2025 · 3 comments
Open

Changes on TimePicker not being reflected. #112

KikoCV opened this issue Mar 17, 2025 · 3 comments

Comments

@KikoCV
Copy link

KikoCV commented Mar 17, 2025

OnSelectionStart and OnSelectionEnd will only be called when changing the dates, not when changing the time in the TimePicker.
This makes the component impossible to use with AutoApply, since it will never callback the correct time values.

One possible fix would be for TimeChanged, based on the parameter that is not null, to call OnSelectionStart or OnSelectionEnd after setting TStartDate/TEndDate.

@jdtcn
Copy link
Owner

jdtcn commented Mar 17, 2025

This behavior is by design (and in the original JavaScript component as well). In my implementation, there's a line in ~\BlazorDateRangePicker\DateRangePicker.razor.cs:270 that sets AutoApply to false if TimePicker is enabled:

if (TimePicker == true && AutoApply == true) AutoApply = false;

This is because it's unclear when the selection is complete and the component should close (after selecting the hour, minute, start time, or end time?). Therefore, I don't see how AutoApply can be used effectively in TimePicker mode. There's an OnRangeSelect event that is triggered on Apply button click, which will provide you with the final selected time values. I can expose an OnTimeSelected event if you'd like, but I don't see a straightforward way to make AutoApply available in this context

@KikoCV
Copy link
Author

KikoCV commented Mar 18, 2025

You are right in that AutoApply can't really be used when TimePicker is enabled.

Exposing a TimeSelected event would suffice in my opinion and use case. Even without an Apply button I can use this new event to capture time changes and then trigger my own ValueChanged callback.

@jdtcn
Copy link
Owner

jdtcn commented Mar 18, 2025

Hi, I have added the OnStartTimeChanged<TimeSpan> and OnEndTimeChanged<TimeSpan> events

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

No branches or pull requests

3 participants
@jdtcn @KikoCV and others