You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi.
I have a problem parsing weeks.
I'm using d3 v3.4.8.
I have dates in a format like 2014-19 - but the format is not a problem, since I have the same problem using 2014(19), 2014 19 and so on...
Is it possible to parse such string using $Y-$W or $Y-$U? e.g.
d3.time.format('%Y-%W').parse('2014-19');
Because I obtain as a result always the date corresponding to the 1st of January 2014
Date{WedJan01201400:00:00GMT+0100}
I'm also parsing months, years, days and it works well. Only weeks are not working.
Actually, there is a workaround, but I'd need to manually add also %w with value 0. E.g.
// I'm getting from elsewhere the 'x' variable, a date in the format YYYY(WW)x=d3.time.format('%Y-%W-%w').parse(w.replace(/([0-9]{4})\(([0-9]{2})\)/g,"$1-$2-0"));
Yes, at the moment we require the day-of-week (%w) for the week-of-year (%U or %W) to be parsed. I don’t see any particular reason why we can’t drop that requirement and use suitable defaults.
Activity
mchinosi commentedon Jun 16, 2014
Actually, there is a workaround, but I'd need to manually add also
%wwith value0. E.g.Thank you
jasondavies commentedon Jun 16, 2014
Yes, at the moment we require the day-of-week (
%w) for the week-of-year (%Uor%W) to be parsed. I don’t see any particular reason why we can’t drop that requirement and use suitable defaults.mbostock commentedon Nov 8, 2015
New behavior:
Parse week-of-year with implicit day-of-week.
mbostock commentedon Nov 8, 2015
Fix staged in #2591 for 3.5.7.
Parse week-of-year with implicit day-of-week.
Parse week-of-year with implicit day-of-week.