We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Change Event Color According To The Time Interval

Thread ID:

Created:

Updated:

Platform:

Replies:

146501 Aug 6,2019 11:16 AM UTC Aug 12,2019 06:18 AM UTC Angular - EJ 2 3
loading
Tags: Schedule
mehmet yanbak
Asked On August 6, 2019 11:16 AM UTC

Hi,

I want to change the color of the event according to the time interval. If the event is back than now, it should be red. If it's going to start at a later time, it should be green, If it is currently in progress, it should be blue. How can I do this ? Please find attached a sample image.

Attachment: schedule_cec8344c.rar

Karthigeyan Krishnamurthi [Syncfusion]
Replied On August 8, 2019 08:45 AM UTC

Hi Mehmet, 
 
Syncfusion greetings. 
 
We can achieve your requirement using eventRendered event and kindly refer the below sample. 
 
eventRendered(args: EventRenderedArgs): void { 
    let data: { [key: string]: Object } = args.data; 
    if ((data.StartTime as Date).getTime() < new Date().getTime() && (data.EndTime as Date).getTime() < new Date().getTime()) { 
      args.element.style.backgroundColor = 'red'; 
    } 
    else if (((data.StartTime as Date).getTime() < new Date().getTime() && (data.EndTime as Date).getTime() > new Date().getTime())) { 
      args.element.style.backgroundColor = 'blue'; 
    } 
    else if ((data.StartTime as Date).getTime() > new Date().getTime() && (data.EndTime as Date).getTime() > new Date().getTime()) { 
      args.element.style.backgroundColor = 'green'; 
    } 
  } 
 
 
 
 
Regards, 
Karthi 


mehmet yanbak
Replied On August 9, 2019 11:59 AM UTC

Hi,

It works, thank you so much :)

Karthigeyan Krishnamurthi [Syncfusion]
Replied On August 12, 2019 06:18 AM UTC

Most welcome 😊


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon