Skip to content

Releases: d3/d3-time-format

v2.1.1

21 Nov 21:50
Compare
Choose a tag to compare

v2.1.0

09 Oct 17:22
Compare
Choose a tag to compare
  • Add %f for microseconds.
  • Add %Q for milliseconds since UNIX epoch. Thanks, @krukon!
  • Add %s for seconds since UNIX epoch. Thanks, @krukon!
  • Add %u for ISO 8601 day of week as a decimal number [1,7]. Thanks, @BrianMitchL!
  • Add %V for ISO 8601 week of year as a decimal number [01, 53]. Thanks, @BrianMitchL!

v2.0.5

10 Mar 17:45
Compare
Choose a tag to compare
  • Update dependencies.

v2.0.4

28 Feb 17:09
Compare
Choose a tag to compare
  • Update dependencies.

v2.0.3

23 Nov 00:58
Compare
Choose a tag to compare
  • Update dependencies.

v2.0.2

02 Aug 21:29
Compare
Choose a tag to compare
  • Add module entry point to package.json.

v2.0.1

29 Jul 22:56
Compare
Choose a tag to compare
  • Add the cs-CA and uk-UA locales.

v2.0.0

24 Jun 17:50
Compare
Choose a tag to compare
  • Change the default U.S. English locale to conform to local conventions (#19).

v1.1.0

22 Jun 22:51
Compare
Choose a tag to compare

v1.0.0

14 Jun 22:57
Compare
Choose a tag to compare
  • First stable release.

Changes since D3 3.x

Pursuant to the great namespace flattening, the format constructors have new names:

The format.parse method has also been removed in favor of separate d3.timeParse, d3.utcParse and d3.isoParse parser constructors. Thus, this code in 3.x:

var parseTime = d3.time.format("%c").parse;

Can be rewritten in 4.0 as:

var parseTime = d3.timeParse("%c");

The multi-scale time format d3.time.format.multi has been replaced by d3.scaleTime’s tick format. Time formats now coerce inputs to dates, and time parsers coerce inputs to strings. The %Z directive now allows more flexible parsing of time zone offsets, such as -0700, -07:00, -07, and Z. The %p directive is now parsed correctly when the locale’s period name is longer than two characters (e.g., “a.m.”).

The default U.S. English locale now uses 12-hour time and a more concise representation of the date. This aligns with local convention and is consistent with date.toLocaleString in Chrome, Firefox and Node:

var now = new Date;
d3.timeFormat("%c")(new Date); // "6/23/2016, 2:01:33 PM"
d3.timeFormat("%x")(new Date); // "6/23/2016"
d3.timeFormat("%X")(new Date); // "2:01:38 PM"

You can now set the default locale using d3.timeFormatDefaultLocale! The locales are published as JSON to NPM.

The performance of time formatting and parsing has been improved, and the UTC formatter and parser have a cleaner implementation (that avoids temporarily overriding the Date global).

See CHANGES for all D3 changes since 3.x.