@namespace AntDesign.Internal @typeparam TValue @inherits DatePickerPanelBase @{ var calendar = CultureInfo.Calendar; DateTime monthFirstDayDate = new DateTime(PickerValue.Year, PickerValue.Month, 1, 0, 0, 0); int monthFirstDayOfWeek = (int)calendar.GetDayOfWeek(monthFirstDayDate); // sunday should be 7 if (monthFirstDayOfWeek == 0) { monthFirstDayOfWeek = DayOfWeekHelper.GetDiffForDayOfWeek(Locale.FirstDayOfWeek); } int diffDay = (int) Locale.FirstDayOfWeek - monthFirstDayOfWeek; DateTime startDate = monthFirstDayDate.AddDays(diffDay); }
@if (IsWeek) { } @foreach(string weekDay in Locale.Lang.ShortWeekDays) { @(weekDay) } @if (IsWeek) { @DateHelper.GetWeekOfYear(context) } @currentColDate.Day
@if (RenderExtraFooter != null && !IsRange) { } @if (ShowToday && !IsRange && Picker != DatePickerType.Time) { } @code { [Parameter] public bool IsWeek { get; set; } = false; [Parameter] public bool ShowToday { get; set; } = false; private string GetRowClass(DateTime viewDate) { string selectedRowClass = IsWeek && DateHelper.IsSameWeak(viewDate, Value) ? $"{PrefixCls}-week-panel-row-selected" : ""; string rowClass = IsWeek ? $"{PrefixCls}-week-panel-row" : ""; return $"{rowClass} {selectedRowClass}"; } private void OnRowSelect(DateTime viewDate) { if (IsWeek) { OnSelectDate(viewDate); } } private void OnValueSelect(DateTime viewDate) { if (!IsWeek) { OnSelectDate(viewDate); } } }