1- // Licensed to the .NET Foundation under one or more agreements.
1+ // Licensed to the .NET Foundation under one or more agreements.
22// The .NET Foundation licenses this file to you under the Apache 2.0 License
33// See the LICENSE file in the project root for more information.
44// Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone
99namespace BootstrapBlazor . Components ;
1010
1111/// <summary>
12- ///
12+ /// 日历框组件
1313/// </summary>
1414public partial class Calendar
1515{
@@ -243,14 +243,7 @@ protected async Task OnChangeYear(int offset)
243243 /// <param name="offset"></param>
244244 protected async Task OnChangeMonth ( int offset )
245245 {
246- if ( offset == 0 )
247- {
248- Value = DateTime . Today ;
249- }
250- else
251- {
252- Value = Value . AddMonths ( offset ) ;
253- }
246+ Value = offset == 0 ? DateTime . Today : Value . AddMonths ( offset ) ;
254247 if ( ValueChanged . HasDelegate )
255248 {
256249 await ValueChanged . InvokeAsync ( Value ) ;
@@ -267,14 +260,7 @@ protected async Task OnChangeMonth(int offset)
267260 /// <param name="offset"></param>
268261 protected async Task OnChangeWeek ( int offset )
269262 {
270- if ( offset == 0 )
271- {
272- Value = DateTime . Today ;
273- }
274- else
275- {
276- Value = Value . AddDays ( offset ) ;
277- }
263+ Value = offset == 0 ? DateTime . Today : Value . AddDays ( offset ) ;
278264 WeekNumberText = Localizer [ nameof ( WeekNumberText ) , GetWeekCount ( ) ] ;
279265 if ( ValueChanged . HasDelegate )
280266 {
0 commit comments