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

args.cell.start.getDayOfWeek() goes from 1 to 6 (no 7 for Sunday)

Asked by B.
9 years ago.

Not sure if this is a bug, but in the sandbox version of Scheduler (1746), the getDayOfWeek() function returns values from 1 to 6. In the previous stable version, Sunday returned 0, now it returns null. Should it be 0 or 7 or null?

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

It should return 0 for Sunday.

Can you please give it a try with the latest sandbox build (1753)?

This returns 0 as expected in the JavaScript console:

new DayPilot.Date("2015-06-21").getDayOfWeek();

This also seems to work:

dp.onBeforeCellRender = function(args) {
  console.log("dayofweek: " + args.cell.start.getDayOfWeek());
};

Let me know if the problem persists with build 1753.

Comment posted by Bert
9 years ago.

I'm using build 1756 and inside the Javascript console, it returns 0, but if I do:

onBeforeCellRender: function(args) {
    args.cell.html = args.cell.start.getDayOfWeek();
}

Then it's empty. I have to turn it into a string for it to show up. But it's working fine now. The

args.header.start.getDayOfWeek() == 0

return true.

Thanks for the help!

Comment posted by Dan Letecky [DayPilot]
9 years ago.

Thanks for the update.

This happens because args.cell.html is evaluated using

if (args.cell.html) { ... }

when printing the value.

The latest build (1758) is now only checking for null and undefined so 0 (number) will get printed.

http://javascript.daypilot.org/sandbox/

Comment posted by Bert
9 years ago.

Worked, thanks!

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