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

Display custom string in time headers

Asked by Hoang Phung
8 years ago.

How do I display the start to end of a week in the first row of time headers? For example, I have the following day pilot config:

dp.scale = 'Day'
dp.timeHeaders = [{ groupBy: "Week" },{ groupBy: "Day", format: "dddd" }]

For the week from 23 Mar to 29 Mar, how do I display: "23 Mar - 29 Mar 2014"?

In addition, is it possible to have abbreviated days of week (Mon, Tue, etc) and months (Jan, Feb, etc)?

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

You can customize the header HTML using onBeforeTimeHeaderRender event handler:

dp.onBeforeTimeHeaderRender = function(args) {
  if (args.header.level === 1) {
    args.header.html = args.header.start.toString("d MMM") + " - " + args.header.end.toString("d MMM yyyy");

See also:

The abbreviated days of week names ("ddd") and abbreviated month names ("MMM") are supported since build 7.7.758.

Please see the sandbox:

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