Skip to content

Commit

Permalink
DatePicker DateRender will not apply class attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
enchev committed Dec 5, 2024
1 parent 58a204e commit 2079404
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Radzen.Blazor/RadzenDatePicker.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1149,14 +1149,20 @@ async Task OnToggle()

string GetDayCssClass(DateTime date, DateRenderEventArgs dateArgs, bool forCell = true)
{
return ClassList.Create()
var list = ClassList.Create()
.Add("rz-state-default", !forCell)
.Add("rz-calendar-other-month", CurrentDate.Month != date.Month)
.Add("rz-state-active", !forCell && DateTimeValue.HasValue && DateTimeValue.Value.Date.CompareTo(date.Date) == 0)
.Add("rz-calendar-today", !forCell && DateTime.Now.Date.CompareTo(date.Date) == 0)
.Add("rz-state-focused", !forCell && FocusedDate.Date.CompareTo(date.Date) == 0)
.Add("rz-state-disabled", !forCell && dateArgs.Disabled)
.ToString();
.Add("rz-state-disabled", !forCell && dateArgs.Disabled);

if (dateArgs.Attributes != null && dateArgs.Attributes.TryGetValue("class", out var @class) && !string.IsNullOrEmpty(Convert.ToString(@class)))
{
list.Add($"{@class}", true);
}

return list.ToString();
}
async Task OnCalendarKeyPress(KeyboardEventArgs args)
{
Expand Down

0 comments on commit 2079404

Please sign in to comment.