search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Change 'today' in DayPilotNavigator?

Asked by Stephanie
5 years ago.

How do you change the DayPilotNavigator to highlight the correct date when you are in a different timezone? I see it is done with css. I tried the following, but that doesn't work...

protected void DayPilotNavigator1_BeforeCellRender(object sender, DayPilot.Web.Ui.Events.Navigator.BeforeCellRenderEventArgs e)
{
// Highlight Today
if (e.Start.ToShortDateString() == GetLocalTime(DateTime.Now).ToShortDateString())
e.CssClass = "navigator_silver_todaybox";
else
e.CssClass = "navigator_silver_daybox";
}

Comment posted by Stephanie
5 years ago.

Any Ideas??

Answer posted by Dan Letecky [DayPilot]
5 years ago.

It looks like the only way is to clear the style for _todaybox in the CSS (to hide the default today indicator) and add a custom class using BeforeCellRender for today.

protected void DayPilotNavigator1_BeforeCellRender(object sender, DayPilot.Web.Ui.Events.Navigator.BeforeCellRenderEventArgs e) 
{ 
  // Highlight Today 
  if (e.Start.ToShortDateString() == GetLocalTime(DateTime.Now).ToShortDateString()) {
    e.CssClass = "today"; 
  }
} 

The custom class is not tested, you may need to tweak it a bit:

.today {
  box-sizing: border-box; /* make sure the border doesn't change the dimensions */
  border: 1px solid red;
}
Comment posted by Stephanie
5 years ago.

Okay, I was going to try that, but I was hoping there was a better way...

This question is more than 3 months old and has been closed. Please create a new question if you have anything to add.