図書館D3
で。日付を処理するための一連の関数に一貫性がありません。たとえば、ページ読み込みのコンソールで次の 4 つの手順を実行すると、次のようD3
になります。
> start = new Date(2010, 11, 30)
Thu Dec 30 2010 00:00:00 GMT+0000 (GMT Standard Time)
> end = new Date(2011, 0, 2)
Sun Jan 02 2011 00:00:00 GMT+0000 (GMT Standard Time)
> d3.time.months(start, end, 1)
[Sat Jan 01 2011 00:00:00 GMT+0000 (GMT Standard Time)]
> d3.time.days(start, end, 1)
[Thu Dec 30 2010 00:00:00 GMT+0000 (GMT Standard Time), Fri Dec 31 2010 00:00:00 GMT+0000 (GMT Standard Time), Sat Jan 01 2011 00:00:00 GMT+0000 (GMT Standard Time)]
上記はday.range
、最初の項目から始まり、2 番目の項目の直前で終わることを示していmonth.range
ますが、逆のことをしているようです。
ドキュメントには次のように記載されています。
# d3.time.months(start, stop[, step])
Alias for d3.time.month.range. Returns the month boundaries (e.g., January 01)
after or equal to start and before stop. If step is specified, then every step'th
month will be returned, based on the month of the year. For example, a step of 3
will return January, April, July, etc.
after or equal to start and before stop
についても言及されてtime.days
いますが、結果は異なるようです。また、これらの関数が開始後と等しいときに戻るのはいつですか? 違いは何ですか?
注意:これらの関数が、開始パラメータと終了パラメータの両方を含む、日、月、年の配列を返すようにしたいと考えています。