events = {
var events = [],
d0,
d1 = d3.timeDay.offset(start, -1),
d2 = d3.timeDay.offset(start, 0),
x0,
x1 = suncalc.getMoonIllumination(d1).fraction,
x2 = suncalc.getMoonIllumination(d2).fraction;
for (var i = 0; i < 365; ++i) {
d0 = d1, d1 = d2, d2 = d3.timeDay.offset(start, i + 1);
x0 = x1, x1 = x2, x2 = suncalc.getMoonIllumination(d2).fraction;
if (x1 > x0 && x1 > x2) {
events.push({date: findMinimum(x => 1 - suncalc.getMoonIllumination(x).fraction, d0, d2), type: "full"});
} else if (x1 < x0 && x1 < x2) {
events.push({date: findMinimum(x => suncalc.getMoonIllumination(x).fraction, d0, d2), type: "new"});
}
}
return events;
}