mbostock/d3 — Issue #449: d3.svg.month
Author: mbostock
Created: 2012-01-20 17:46:57+00:00
State: open
Labels: req

It might be nice to take this code out of the calendar example and include it in the core library:

```js
function monthPath(t0) {
var t1 = new Date(t0.getFullYear(), t0.getMonth() + 1, 0),
d0 = +day(t0), w0 = +week(t0),
d1 = +day(t1), w1 = +week(t1);
return "M" + (w0 + 1) * size + "," + d0 * size
+ "H" + w0 * size + "V" + 7 * size
+ "H" + w1 * size + "V" + (d1 + 1) * size
+ "H" + (w1 + 1) * size + "V" + 0
+ "H" + (w0 + 1) * size + "Z";
}
```

Some convenient extensions:

* The size should be configurable.
* The use of Sunday- or Monday-based weeks should be configurable.
* Vertical or horizontal orientation might be nice.
* Positioning relative to the first week in the month rather than the first week in the year.