Home Unanswered Active Tags New Question

DayPilotScheduler TimeFormat does not appy to events--?

Setting the DayPilotScheduler.TimeFormat = DayPilot.Web.Ui.Enums.TimeFormat.Clock24Hours works great for the headers (displays hours from 0 to 23 within a day), but it doesn't seem to display the events in 24-hour format (I see "11pm" in the event box, for example). Is there a separate setting for header vs. event timeformat?

Thoughts?

Thanks!

Asked by Ray 4 years ago.
Replies
Yes, the time format in events is taken from the current Culture.

You can also overrride it using BeforeEventRender event handler (modify e.InnerHTML).
Comment posted by Dan Letecky 4 years ago.

Thanks!

This got me going and looks consistent with the TimeFormat setting = 24 hour (using en-us culture):

System.Globalization.DateTimeFormatInfo dtfi = new System.Globalization.DateTimeFormatInfo();
dtfi.ShortDatePattern = "MM/dd/yyyy";
if (timeFormat24Hour)
{
dtfi.ShortTimePattern = "HH:mm";
}
else
{
dtfi.ShortTimePattern = "hh:mm tt";
}
System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat = dtfi;

Also, FYI, not a big deal since we'll be buying the licensed vers soon, but the DEMO version of the Scheduler looks slightly funky because (I believe) the "DEMO" text creates awkward vertical spacing in the hours headers.

Comment posted by Ray 4 years ago.
BTW, that DEMO spacing issue wasn't occuring in 4.6, but was noticed after upgrade to 4.7.
Comment posted by Ray 4 years ago.
TimeFormat: In one of the future versions I will make it more consistent:
  • The TimeFormat will be determining the time format in the events as well.
  • TimeFormat now has three possible values (Clock12Hours, Clock24Hours, and Auto). The Auto option (it loads the time format from the current culture) was added recently and eliminates the need for separate setting of the time format in the headers.
Thanks for the DEMO note, I will check that!
Comment posted by Dan Letecky 4 years ago.
New Reply
This reply is
Your name (optional):

DayPilot for ASP.NET WebForms, DayPilot for ASP.NET MVC, DayPilot for Java