AngualrJS kendo-date-picker, how to color day cells.

1 Answer 16 Views
Date/Time Pickers
Clint
Top achievements
Rank 1
Iron
Iron
Iron
Clint asked on 01 Feb 2024, 02:24 PM

This is a follow-up to my original question:

I have a Kendo Date Picker for AngualrJS and I would like to color the individual day cells for a given day within the month.

https://www.telerik.com/forums/angualrjs-kendo-date-picker-how-to-color-day-cells

The follow-up question is:

I see that you can tie a colour background to a particular day value within a month, but how would you do that to a specific date (i.e. Make only the 10th of January red, but not the 10th of February, for example)?

1 Answer, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 06 Feb 2024, 07:19 AM

Hi Clint,

For convenience, I am pasting my reply from the other thread below as well, as it could be helpful to the other user in the forum:

You can access the full Date() object through data.date. Then you can use JavaScript methods such as getMonth() and getFullYear() to customize the appearance only of the needed dates. Below is an example:

month: {
            content: (data) => `<span class="${(data.date.getDate() == 9 && data.date.getMonth() == 2 && data.date.getFullYear() == 2024) ? 'color' : ''}">${data.value}</span>`
          },

Here is the modified Dojo example: - https://dojo.telerik.com/@NeliKondova/EHiDiZOl

Regards,
Neli
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources
Tags
Date/Time Pickers
Asked by
Clint
Top achievements
Rank 1
Iron
Iron
Iron
Answers by
Neli
Telerik team
Share this question
or