Skip to content
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

SelectedDate Parameter conflict when Event are used #97

Open
julienGrd opened this issue Feb 24, 2020 · 0 comments
Open

SelectedDate Parameter conflict when Event are used #97

julienGrd opened this issue Feb 24, 2020 · 0 comments

Comments

@julienGrd
Copy link

Hello, it seem there is a problem when i use the parameter SelectedDate with the different events (for example ViewModeChanged).

to reproduce, update this part of your demo project

`Subscribe to events raised by the control.
<DatePicker Inline=true OnSelectedDateChanged=@changed OnSelected=@selected OnCleared=@cleared OnViewModeChanged="OnViewModeChanged" SelectedDate="@SelectedDateEvent" />

protected void OnViewModeChanged(NodaTimePicker.ViewMode mode)
    {
        Console.WriteLine("SelectedDateEvent" + SelectedDateEvent.ToString());
        Console.WriteLine("viewmode changed " + mode.ToString());
        StateHasChanged();
    }

 protected LocalDate? SelectedDateEvent { get; set; }
`

With this configuration, if you navigate to the year/month of the component and go to a different month/year than the initial SelectedDate (click on the month to open the list of monts and click on a different month), it always come back to the year/Month of the SelectedDate (because it hasn't changed yet).

I think you have to deal with two different date in your component to make this works together :

  • a internal date used for navigation, not exposed
  • the real selected Date

PS : a parameter InitialSelectedDate used only at startup can make the job too. With this, i can remove the SelectedDate parameter and works only for event. But i need initialized your component with a value different than today.

PS2 : i try also to activate your event OnMonthChanged but i have the same kind of behavior. The selectedDate not change so i always stuck on the mont/year of the selectedDate. Maybe thats why its not activated yet ?

Thanks !

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

1 participant