diff --git a/src/Masa.Blazor/Components/DatePicker/MDatePicker.razor b/src/Masa.Blazor/Components/DatePicker/MDatePicker.razor index d558e0aebe..8e62987f24 100644 --- a/src/Masa.Blazor/Components/DatePicker/MDatePicker.razor +++ b/src/Masa.Blazor/Components/DatePicker/MDatePicker.razor @@ -69,6 +69,7 @@ Min="@MinYear" Max="@MaxYear" Value="@TableYear" + TableDate="@TableDate" Locale="@CurrentLocale" Type="@Type" OnInput="@OnYearClickAsync" diff --git a/src/Masa.Blazor/Components/DatePicker/MDatePickerYears.razor b/src/Masa.Blazor/Components/DatePicker/MDatePickerYears.razor index 09396ba9ad..7d439815ba 100644 --- a/src/Masa.Blazor/Components/DatePicker/MDatePickerYears.razor +++ b/src/Masa.Blazor/Components/DatePicker/MDatePickerYears.razor @@ -29,7 +29,7 @@ class="@GetClass(CssClassUtils.GetTextColor(color), active ? "active" : null)" style="@(StyleBuilder.Create().AddTextColor(color))" @onclick="@(() => HandleOnYearItemClickAsync(year))"> - @Formatter(new DateOnly(year, 1, 1)) + @Formatter(new DateOnly(year, TableDate.Month, TableDate.Day)) }; } \ No newline at end of file diff --git a/src/Masa.Blazor/Components/DatePicker/MDatePickerYears.razor.cs b/src/Masa.Blazor/Components/DatePicker/MDatePickerYears.razor.cs index cfc6b0b169..2877b7c27c 100644 --- a/src/Masa.Blazor/Components/DatePicker/MDatePickerYears.razor.cs +++ b/src/Masa.Blazor/Components/DatePicker/MDatePickerYears.razor.cs @@ -13,6 +13,9 @@ public partial class MDatePickerYears : MasaComponentBase [Parameter] public int Value { get; set; } + // for issue #2097 + [Parameter] public DateOnly TableDate { get; set; } + [Parameter] public EventCallback OnInput { get; set; } [Parameter] public EventCallback OnYearClick { get; set; }