@namespace AntDesign.Internal @typeparam TValue @inherits DatePickerPanelBase @using System.Globalization; @{ var calendar = this.DatePicker.CultureInfo.Calendar; DateTime monthFirstDayDate = new DateTime(PickerValue.Year, PickerValue.Month, 1, 0, 0, 0); DayOfWeek monthFirstDayOfWeek = calendar.GetDayOfWeek(monthFirstDayDate); int diffDay = (int)this.DatePicker.CultureInfo.DateTimeFormat.FirstDayOfWeek - (int)monthFirstDayOfWeek; DateTime startDate = monthFirstDayDate.AddDays(diffDay); }
@if (IsShowTime) { @foreach(string weekDay in this.DatePicker.CultureInfo.GetDateLocale().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) { }