diff --git a/src/BlazorUI/Bit.BlazorUI/Components/Inputs/_Pickers/TimePicker/BitTimePicker.razor.cs b/src/BlazorUI/Bit.BlazorUI/Components/Inputs/_Pickers/TimePicker/BitTimePicker.razor.cs index c61a83619a..8e066dda34 100644 --- a/src/BlazorUI/Bit.BlazorUI/Components/Inputs/_Pickers/TimePicker/BitTimePicker.razor.cs +++ b/src/BlazorUI/Bit.BlazorUI/Components/Inputs/_Pickers/TimePicker/BitTimePicker.razor.cs @@ -122,6 +122,7 @@ private string? _minuteView /// CultureInfo for the TimePicker /// [Parameter, ResetClassBuilder] + [CallOnSet(nameof(HandleParameterChanges))] public CultureInfo? Culture { get; set; } /// @@ -309,11 +310,6 @@ protected override void OnInitialized() base.OnInitialized(); } - protected override void OnParametersSet() - { - _culture = Culture ?? CultureInfo.CurrentUICulture; - } - protected override bool TryParseValueFromString(string? value, [MaybeNullWhen(false)] out TimeSpan? result, [NotNullWhen(false)] out string? validationErrorMessage) { if (value.HasNoValue()) @@ -432,6 +428,11 @@ private async Task HandleOnClick() await OnClick.InvokeAsync(); } + private void HandleParameterChanges() + { + _culture = Culture ?? CultureInfo.CurrentUICulture; + } + private async Task UpdateCurrentValue() { CurrentValue = (_hour.HasValue is false || _minute.HasValue is false) ? null : new TimeSpan(_hour.Value, _minute.Value, 0);