The Syncfusion® native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
PKPriyanka Karthikeyan Syncfusion Team October 4, 2024 12:05 PM UTC
Hi ThreeGo,
To change the font color of specific days (like Saturday and Sunday) in the Syncfusion Vue DatePicker, DateRangePicker, or Calendar component, you can use the renderDayCell event. This event allows you to customize the appearance of specific days by adding custom classes or inline styles based on the date.
Here's an example that highlights Saturdays and Sundays in red for a Vue DatePicker:
<template>
<div class="col-lg-12 control-section">
<div id="wrapper">
<ejs-datepicker
id="datepicker"
:renderDayCell="disableDate"
:placeholder="waterMarkText">
</ejs-datepicker>
</div>
</div>
</template>
<script>
methods: {
disableDate(args) {
// Get the day of the week (0 = Sunday, 6 = Saturday)
const day = args.date.getDay();
// Set font color for Saturdays and Sundays
if (day === 0 || day === 6) { // Sunday = 0, Saturday = 6
args.element.lastChild.style.color = "red" // Change the color to red
}
}
}
};
</script>
Explanation:
The renderDayCell event is triggered for each cell (day) in the DatePicker. It passes an argument (args) that contains the date and element of each day.
Inside the onRenderDayCell method, you can get the day of the week using getDay() (0 = Sunday, 6 = Saturday).
The style of the cell (day) is changed by applying the style.color property directly to the element for Saturdays and Sundays.