All examples By author By category About

mbostock

Monday-based Calendar

An example adaption of D3’s calendar-view using weeks that start on Monday. The only change is the definition of the day number and week number methods. For a Sunday-based week, use:

var day = function(d) { return d.getDay(); },
    week = d3.time.format("%U");

For a Monday-based week, use:

var day = function(d) { return (d.getDay() + 6) % 7; },
    week = d3.time.format("%W");