diff --git a/src/BootstrapBlazor/Components/Calendar/Calendar.razor b/src/BootstrapBlazor/Components/Calendar/Calendar.razor
index d499eeb35d32448b1badf02aeb29d6905a3f827a..608e266aa2723ffde8a55fb4e7af0f646dc259a9 100644
--- a/src/BootstrapBlazor/Components/Calendar/Calendar.razor
+++ b/src/BootstrapBlazor/Components/Calendar/Calendar.razor
@@ -8,6 +8,9 @@
@GetTitle()
diff --git a/src/BootstrapBlazor/Components/Calendar/Calendar.razor.cs b/src/BootstrapBlazor/Components/Calendar/Calendar.razor.cs
index 8b1cd63f6daf91ff70029f8440f3e024494a1784..e8e0affd0a06f5d794b4fd5b8ad44e3f85c14725 100644
--- a/src/BootstrapBlazor/Components/Calendar/Calendar.razor.cs
+++ b/src/BootstrapBlazor/Components/Calendar/Calendar.razor.cs
@@ -16,6 +16,12 @@ namespace BootstrapBlazor.Components
///
public sealed partial class Calendar
{
+ [NotNull]
+ private string? PreviousYear { get; set; }
+
+ [NotNull]
+ private string? NextYear { get; set; }
+
[NotNull]
private string? PreviousMonth { get; set; }
@@ -65,6 +71,8 @@ namespace BootstrapBlazor.Components
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
+ PreviousYear = Localizer[nameof(PreviousYear)];
+ NextYear = Localizer[nameof(NextYear)];
PreviousMonth = Localizer[nameof(PreviousMonth)];
NextMonth = Localizer[nameof(NextMonth)];
Today = Localizer[nameof(Today)];
diff --git a/src/BootstrapBlazor/Components/Calendar/CalendarBase.cs b/src/BootstrapBlazor/Components/Calendar/CalendarBase.cs
index 949c596b7a7ac73982b42564c28216f1921756fd..747e158c7cbb926c15281127320cd81681ec2c28 100644
--- a/src/BootstrapBlazor/Components/Calendar/CalendarBase.cs
+++ b/src/BootstrapBlazor/Components/Calendar/CalendarBase.cs
@@ -93,6 +93,16 @@ namespace BootstrapBlazor.Components
StateHasChanged();
});
+ ///
+ /// 右侧快捷切换年按钮回调此方法
+ ///
+ ///
+ protected void OnChangeYear(int offset)
+ {
+ if (offset == 0) Value = DateTime.Today;
+ else Value = Value.AddYears(offset);
+ }
+
///
/// 右侧快捷切换月按钮回调此方法
///
diff --git a/src/BootstrapBlazor/Locales/en.json b/src/BootstrapBlazor/Locales/en.json
index 4f9a74c6ffafd3b5aaf49c2a9b3925cf99955fe3..c22a999d46df9ec819b6c20ba636eb50335e030d 100644
--- a/src/BootstrapBlazor/Locales/en.json
+++ b/src/BootstrapBlazor/Locales/en.json
@@ -29,9 +29,11 @@
"NotFoundDevicesString": "Not found video device"
},
"BootstrapBlazor.Components.Calendar": {
+ "PreviousYear": "Previous Year",
"PreviousMonth": "Previous Month",
"Today": "Today",
"NextMonth": "Next Month",
+ "NextYear": "Next Year",
"PreviousWeek": "Previous Week",
"WeekText": "Week",
"NextWeek": "Next Week",
diff --git a/src/BootstrapBlazor/Locales/zh.json b/src/BootstrapBlazor/Locales/zh.json
index af28a8a353f9495f6421b8020e6f6a595ff52bfb..cb25ed36b7fd0637ba6663e45c5214a0fc00210f 100644
--- a/src/BootstrapBlazor/Locales/zh.json
+++ b/src/BootstrapBlazor/Locales/zh.json
@@ -29,9 +29,11 @@
"NotFoundDevicesString": "未找到视频相关设备"
},
"BootstrapBlazor.Components.Calendar": {
+ "PreviousYear": "上一年",
"PreviousMonth": "上一月",
"Today": "今天",
"NextMonth": "下一月",
+ "NextYear": "下一年",
"PreviousWeek": "上一周",
"WeekText": "本周",
"NextWeek": "下一周",