NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #581 most downloaded on npm
A calculator for humanity’s peculiar conventions of time.
Last release 4 years ago
no release in 18 months
Release timing varies
gaps range from 1 weeks to 1.5 years
Most releases are documented
notes for 28 of 37 stable releases
Nothing withdrawn
no release was ever pulled
13 years old
38 releases · first in 2014
Add d3.unixDay and d3.unixDays . #58
This package now requires Node.js 12 or higher. For more, please read Sindre Sorhus’s FAQ .
This package now requires Node.js 12 or higher. For more, please read Sindre Sorhus’s FAQ.
One column per quarter.
Fix crash in d3.timeTicks and d3.utcTicks when the given interval is invalid.
Add d3.timeTicks and d3.utcTicks .
This release adopts ES2015 language features such as for-of and drops support for older browsers, including IE. If you need to support pre-ES2015 envi
Nothing published for this version
Allow shorthand for current time intervals ( e.g. , d3.timeDay() returns today’s midnight).
d3.timeDay() returns today’s midnight).Fix d3.timeMinute and d3.timeHour for historical times.
Housekeeping.
Update dependencies.
Protect against infinite loop in *interval*.range.
Fix *interval*.offset on filtered intervals when *step* is negative.
Nothing published for this version
Nothing published for this version
Fix hang in _interval_.every(…).range given invalid dates (d3/d3-scale#78).
Nothing published for this version
Add module entry point to package.json.
module entry point to package.json.Nothing published for this version
Pursuant to the great namespace flattening, the local time intervals have been renamed:
Pursuant to the great namespace flattening, the local time intervals have been renamed:
The UTC time intervals have likewise been renamed:
The local time range aliases have been renamed:
The UTC time range aliases have been renamed:
The behavior of interval.range (and the convenience aliases such as d3.timeDays) has been changed when step is greater than one. Rather than filtering the returned dates using the field number, interval.range now behaves like d3.range: it simply skips, returning every _step_th date. For example, the following code in 3.x returns only odd days of the month:
d3.time.days(new Date(2016, 4, 28), new Date(2016, 5, 5), 2);
// [Sun May 29 2016 00:00:00 GMT-0700 (PDT),
// Tue May 31 2016 00:00:00 GMT-0700 (PDT),
// Wed Jun 01 2016 00:00:00 GMT-0700 (PDT),
// Fri Jun 03 2016 00:00:00 GMT-0700 (PDT)]
Note the returned array of dates does not start on the start date because May 28 is even. Also note that May 31 and June 1 are one day apart, not two! The behavior of d3.timeDays in 4.0 is probably closer to what you expect:
d3.timeDays(new Date(2016, 4, 28), new Date(2016, 5, 5), 2);
// [Sat May 28 2016 00:00:00 GMT-0700 (PDT),
// Mon May 30 2016 00:00:00 GMT-0700 (PDT),
// Wed Jun 01 2016 00:00:00 GMT-0700 (PDT),
// Fri Jun 03 2016 00:00:00 GMT-0700 (PDT)]
If you want a filtered view of a time interval (say to guarantee that two overlapping ranges are consistent, such as when generating time scale ticks), you can use the new interval.every method or its more general cousin interval.filter:
d3.timeDay.every(2).range(new Date(2016, 4, 28), new Date(2016, 5, 5));
// [Sun May 29 2016 00:00:00 GMT-0700 (PDT),
// Tue May 31 2016 00:00:00 GMT-0700 (PDT),
// Wed Jun 01 2016 00:00:00 GMT-0700 (PDT),
// Fri Jun 03 2016 00:00:00 GMT-0700 (PDT)]
Time intervals now expose an interval.count method for counting the number of interval boundaries after a start date and before or equal to an end date. This replaces d3.time.dayOfYear and related methods in 3.x. For example, this code in 3.x:
var now = new Date;
d3.time.dayOfYear(now); // 165
Can be rewritten in 4.0 as:
var now = new Date;
d3.timeDay.count(d3.timeYear(now), now); // 165
Likewise, in place of 3.x’s d3.time.weekOfYear, in 4.0 you would say:
d3.timeWeek.count(d3.timeYear(now), now); // 24
The new interval.count is of course more general. For example, you can use it to compute hour-of-week for a heatmap:
d3.timeHour.count(d3.timeWeek(now), now); // 64
Here are all the equivalences from 3.x to 4.0:
D3 4.0 now also lets you define custom time intervals using d3.timeInterval. The d3.timeYear, d3.utcYear, d3.timeMillisecond and d3.utcMillisecond intervals have optimized implementations of interval.every, which is necessary to generate time ticks for very large or very small domains efficiently. More generally, the performance of time intervals has been improved, and time intervals now do a better job with respect to daylight savings in various locales.
See CHANGES for all D3 changes since 3.x.
Optimize d3.timeYear.every and d3.utcYear.every (d3/d3-scale#65).
- Internal cleaning of exports.
Export to the global d3 in vanilla environments (d3/d3#2840).
d3 in vanilla environments (d3/d3#2840).Fix timezone tests on Node 6 (#11).
Fix a bug where d3.timeDay.{ceil,round} might not return midnights (#2).
Fix a bug where d3.timeDay.range might not return midnights (#2).
Fix a bug where the starting month could be skipped in d3.timeMonth.range.
Fix infinite loop in d3.timeHour.range due to daylight saving (#10).
Nothing published for this version
Prefix exported symbols with “time”.
Nothing published for this version
- Add _interval_.every.
Define d3-time module (and d3_time global), not time.
d3-time module (and d3_time global), not time.Adjust package.json definition for npm users.
Expose interval constructor for custom interval implementations.
Nothing published for this version
Fix a bug in _interval_.range where some dates were not floored.
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →