2

i have a line chart in D3 where i can aggregate the values within the char to days, weeks, month and year.

For that purpose i deliver differnt date formats within my chart data.

DAYS: 2005-12-31

WEEK: 2005-26

MONTH: 2005-12

YEAR: 2005

Within D3 those patterns can be parsed with

var parseDate = d3.time.format(settings.d3pattern).parse;

Oficially, according to the current version of D3, the week pattern can be parsed with %Y-%U. There is no information about problems with the %U pattern as stated in javascript d3.js date string parsing issue . But i'm getting an error when i try to parse the week format.

The only parsing concern is "The %Z directive (time zone offset, such as "-0700") is not yet supported for parsing." Source: https://github.com/mbostock/d3/wiki/Time-Formatting

Can someone please comment 1. Other methods to parse dates by a week based pattern. Tools like moment.js do not offer a pattern for the week of the year and 2. Should D3 in the current version be able to parse this date or not.

1 Answer 1

0

See the first comment of How to convert a week number to a date in Javascript : it gets a pretty complete and tested method to get the first day of a year+week.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.