@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); Console.WriteLine($"{DateTime.Now} DatePickerDatePanel.razor monthFirstDayOfWeek: {monthFirstDayOfWeek}"); } int diffDay = (int)Locale.FirstDayOfWeek - monthFirstDayOfWeek; DateTime startDate = monthFirstDayDate.AddDays(diffDay); }
@if (IsShowTime) { @foreach(string weekDay in Locale.Lang.ShortWeekDays) { @weekDay } @currentColDate.Day } @{ var startTime = new DateTime(2020, 1, 1, 0, 0, 0); var timeFormat = ShowTimeFormat; if (Picker == DatePickerType.Time && !string.IsNullOrEmpty(Format)) { timeFormat = Format; } DatePickerDisabledTime disabledTime = GetDisabledTime(); bool isValueNull = Value is null; Func selected; string localValue; if (Value is null) { localValue = ""; selected = (_, _) => ""; } else { localValue = Value.Value.ToString(timeFormat); selected = (viewTime, valueTime) => viewTime == valueTime ? $"{PrefixCls}-time-panel-cell-selected" : ""; } }
@if(Picker == DatePickerType.Date) {
@localValue
}
@if (timeFormat.ToLower().Contains("hh")) {
    @for (int hour = 0; hour < 24; hour++) { var viewTime = startTime; bool disabled = disabledTime._disabledHours.Contains(hour); string isSelectedCls = selected(viewTime.Hour, Value?.Hour); string disabledCls = disabled ? $"{PrefixCls}-time-panel-cell-disabled" : "";
  • @hour
  • startTime = startTime.AddHours(1); }
} @if (timeFormat.ToLower().Contains("mm")) {
    @for (int minute = 0; minute < 60; minute++) { var viewTime = startTime; bool disabled = disabledTime._disabledMinutes.Contains(minute); string isSelectedCls = selected(viewTime.Minute, Value?.Minute); string disabledCls = disabled ? $"{PrefixCls}-time-panel-cell-disabled" : "";
  • @minute
  • startTime = startTime.AddMinutes(1); }
} @if (timeFormat.ToLower().Contains("ss")) {
    @for (int second = 0; second < 60; second++) { var viewTime = startTime; bool disabled = disabledTime._disabledSeconds.Contains(second); string isSelectedCls = selected(viewTime.Second, Value?.Second); string disabledCls = disabled ? $"{PrefixCls}-time-panel-cell-disabled" : "";
  • @second
  • startTime = startTime.AddSeconds(1); }
}
@if (RenderExtraFooter != null) { }