@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(); }
@if(Picker == DatePickerType.Date) {
@Value.ToString(timeFormat)
}
@if (timeFormat.ToLower().Contains("hh")) {
    @for (int hour = 0; hour < 24; hour++) { var viewTime = startTime; bool disabled = disabledTime._disabledHours.Contains(hour); string isSelectedCls = viewTime.Hour == Value.Hour ? $"{PrefixCls}-time-panel-cell-selected" : ""; 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 = viewTime.Minute == Value.Minute ? $"{PrefixCls}-time-panel-cell-selected" : ""; 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 = viewTime.Second == Value.Second ? $"{PrefixCls}-time-panel-cell-selected" : ""; string disabledCls = disabled ? $"{PrefixCls}-time-panel-cell-disabled" : "";
  • @second
  • startTime = startTime.AddSeconds(1); }
}
@if (RenderExtraFooter != null) { }