d3-time-format icon indicating copy to clipboard operation
d3-time-format copied to clipboard

Year support for "10000"

Open I563099 opened this issue 2 years ago • 2 comments

In the file-"d3.js", Method-"format.parse" and line-if (i != string.length) return null; Year is supported only till "9999"(string.length=14) if year "10000" is passed then it is returning as null because length will be increased by 1(string.length=15). Is it a technical restriction or is there any other way forward to handle such scenarios ?

I563099 avatar Oct 31 '23 08:10 I563099

The %Y specifier is defined as a four-digit year so that you can do things like %Y%m%d and parse digits with no separator.

d3.utcParse("%Y%m%d")("20200101") // 2020-01-01T00:00:00.000Z

If we want to parse variable-digit years then we would need a different specifier.

mbostock avatar Nov 05 '23 18:11 mbostock

The version of D3 we are using is - D3 v3.4.12 - http://d3js.org/

Sample example: https://jsbin.com/rubufenida/edit?html,js,console,output

Is there any specifier which we can use for year "10000" as specified in above sample? Because we didn't find any in - https://observablehq.com/@bumbeishvili/d3-timeformat-playground

If not what is the alternative which we can use. Please let us know.

I563099 avatar Nov 07 '23 03:11 I563099