Highlight the current date

How to highlight the current date today?Screenshot (471).png


10 Replies

BC Belle Cruz December 22, 2021 01:56 AM UTC

is there any update about my query?



RM Ruksar Moosa Sait Syncfusion Team December 22, 2021 07:21 AM UTC

Hi Belle Cruz,


Greetings from Syncfusion Support.


The current date will be automatically highlighted in the Scheduler by default.



If you want customize the highlighted scheduler, you can achieve it by overriding the e-current-day CSS class like below.


.e-schedule .e-vertical-view .e-header-cells.e-current-day {

    color: #dc3545;

}



Kindly try the above solution and let us know if this meets your requirement.


Regards,

Ruksar M



BC Belle Cruz December 22, 2021 07:33 AM UTC

Thank you Ruksar but it didn't work.



VM Vengatesh Maniraj Syncfusion Team December 22, 2021 07:36 AM UTC

Hi Belle,


Thanks for the update.

We would like to know what are the properties used in the Scheduler. So could you please share the scheduler rendering codes?


Regards,

Vengatesh 



BC Belle Cruz December 22, 2021 07:40 AM UTC

<SfSchedule TValue="AppointmentData" CssClass="schedule-overview" Height="250px">

 <ScheduleEvents TValue="AppointmentData" OnPopupOpen="@OnPopupOpen"></ScheduleEvents>

 <ScheduleTimeScale Enable="false"></ScheduleTimeScale>


</SfSchedule>


@code {


    public class AppointmentData

    {

        public DateTime StartTime { get; set; }

        public DateTime EndTime { get; set; }

    }


    public DateTime Year { get; set; } = DateTime.Now;

    DateTime year1 = new DateTime(2019, 12, 16);

    DateTime year2 = new DateTime(2020, 12, 16);

    DateTime year3 = new DateTime(2022, 12, 16);


    public void OnPopupOpen(PopupOpenEventArgs<AppointmentData> args)

    {

        if (args.Type == PopupType.Editor || args.Type == PopupType.QuickInfo)

        {

            args.Cancel = true;

        }

    }

}


<style>



    .bootstrap5 .schedule-overview .overview-toolbar .e-toolbar {

        border: 1px solid #dee2e6;

    }


    .bootstrap5-dark .schedule-overview .overview-toolbar .e-toolbar {

        border: 1px solid #444c54;

    }


    .schedule-overview .overview-content {

        border: 1px solid #00000026;

        border-top: 0;

        display: none;

    }


    .schedule-overview .overview-scheduler {

        height: 100%;

        padding: 10px;

        width: 100%;


    }


    .schedule-overview .e-schedule-toolbar .e-views,

    .schedule-overview .e-schedule-toolbar .e-schedule-seperator,

    .schedule-workweek.e-multi-select-list-wrapper.e-checkbox .e-filter-parent,

    .schedule-resource.e-multi-select-list-wrapper.e-checkbox .e-filter-parent {

        display: none;

    }


    th {

        padding-right: 110px;

        font-size: 20px;

        color: black;

        font-weight: bolder;

    }


    .e-toolbar .e-toolbar-item {

        font-weight: bolder;

        font-size: 50px;

    }


    p {

        color: black;

        font-size: 30px;

        font-weight: bolder;

    }


    #container {

        display: flex;

        background-color: black;

    }


        #container div {

            align-items: center;

            margin: 50px;

            font-size: 30px;

            font-weight: bolder;

            color: white;

        }


    th {

        display: none;

    }


    .e-toolbar .e-tbar-btn:focus {

        background: #7b94f6;

        border: 1px solid #5a70cc;

    }


    .e-toolbar {

        border: 1px solid #dee2e6;


    }


        .e-toolbar.fill-class,

        .e-toolbar.fill-class .e-toolbar-items,

        .e-toolbar.fill-class .e-toolbar-items .e-toolbar-item,

        .e-toolbar.fill-class .e-toolbar-items .e-toolbar-item button {

            background-color: aquamarine !important;

        }


    .e-today {

        display: none !important;

        /* To hide Today option*/

    }


    .e-schedule .e-vertical-view .e-work-cells {

        display: none;

    }


    .e-schedule .e-vertical-view .e-header-cells. e-current-day {

        color: #dc3545;

    }

</style>




BC Belle Cruz December 23, 2021 06:20 AM UTC

Is there any update about my query?



RM Ruksar Moosa Sait Syncfusion Team December 23, 2021 04:49 PM UTC

Hi Belle,

Thanks for the update.

We have checked the reported problem and let you know that we could reproduce it at our end. So, we have logged the below bug report. The fix will be included in our weekly patch release which is expected to roll out on January 4, 2022 and would appreciate your valuable patience until then. You can track the status by using the below link.


https://www.syncfusion.com/feedback/31461/the-current-date-is-not-highlighted-when-the-timescale-is-disabled


Regards,
Ruksar M



VM Vengatesh Maniraj Syncfusion Team January 5, 2022 05:45 AM UTC

Hi All, 

Thanks for being patience. 

We are glad to announce that our weekly patch release v19.4.41 has been rolled out successfully. The reported bug with the “current date is not highlighted” has been fixed in this release. As a result, we recommend you upgrade to the latest version of our Syncfusion package to avail this fix. 

  
Kindly check the reported defect in the latest version and get back to us if you need any further assistance.  
 
Regards, 
  
Vengatesh 



AR Arnie Reyes January 23, 2024 01:18 AM UTC

 hello syncfusion team 

is there a way to highlight current date for the whole column
timelineview month.. i haven't seen any options available..


Example: this part the whole column of the current date must be highlighted

 


thanks



RR Ram Raju Elaiyaperumal Syncfusion Team January 23, 2024 03:28 PM UTC

Hi Arnie Reyes,


Based on your query, it appears you are looking to highlight the entire column of the current date in the TimelineView Month. While there may not be a direct option to achieve this, you can utilize the OnRenderCell event which is triggered when each cell is rendered.


By adding a check within this event to determine if the date is the current date, you can add a custom CSS class to the cell. This class can then be styled to highlight the cell, effectively highlighting the entire column for the current date.


Here is a sample implementation:


<SfSchedule TValue="AppointmentData" Height="700px">

    <ScheduleEvents TValue="AppointmentData" OnRenderCell="OnRenderCell"></ScheduleEvents>

    <ScheduleGroup Resources="@Resources"></ScheduleGroup>

    <ScheduleResources>

        <ScheduleResource TItem="ResourceData" TValue="int[]" DataSource="@OwnersData" Field="OwnerId" Title="Owner" Name="Owners" TextField="OwnerText" IdField="Id" ColorField="OwnerColor" AllowMultiple="true"></ScheduleResource>

    </ScheduleResources>

    <ScheduleEventSettings DataSource="@DataSource"></ScheduleEventSettings>

    <ScheduleViews>

        <ScheduleView Option="View.TimelineMonth"></ScheduleView>

        <ScheduleView Option="View.TimelineWeek"></ScheduleView>

    </ScheduleViews>

</SfSchedule>

 

<style>

    .e-work-cells.e-work-days.custom-class {

        background-color: peachpuff !important;

    }

</style>

 


DateTime CurrentDate = DateTime.Today;  

 

public void OnRenderCell(RenderCellEventArgs args)

    {

        if (args.ElementType == ElementType.MonthCells && args.Date.Date == CurrentDate)

        {

            args.CssClasses = new List<string>(CustomClass); //The default work hours color is changed to ivory color

        }

    }


In this code, the OnRenderCell event checks if the date of the cell is the current date. If it is, it adds a custom CSS class to the cell. The CSS class is then styled to change the background color of the cell.


For Your convenience we have created a sample based on your requirement, Kindly check on the sample: https://blazorplayground.syncfusion.com/BDLJXsVKoyxfOTfs


We hope this solution meets your requirements. Please let us know if you have any further questions or concerns.



Regards,

Ram


Loader.
Up arrow icon