Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

day.ceil doesn’t always return boundary dates. #3

Closed
mbostock opened this issue Jun 28, 2015 · 2 comments
Closed

day.ceil doesn’t always return boundary dates. #3

mbostock opened this issue Jun 28, 2015 · 2 comments

Comments

@mbostock
Copy link
Member

Related #1 #2 d3/d3#1197.

TZ=Asia/Amman node
> d = new Date(2014, 2, 27)
Thu Mar 27 2014 00:00:00 GMT+0200 (EET)
> time.day.ceil(+d + 1)
Thu Mar 27 2014 23:00:00 GMT+0200 (EET)

The expected answer is Fri Mar 28 2014 01:00:00 GMT+0300 (EEST) The problem is that day.ceil relies on offseti, which increments date.setDate.

@mbostock
Copy link
Member Author

This applies by extension to week and month.

mbostock added a commit that referenced this issue Jun 28, 2015
However, this does not help #2 or #3 because offset does not preserve the delta
between the date and the closest boundary, so range and ceil may sometimes not
return boundary dates. Also, this doesn’t fix week and month.
mbostock added a commit that referenced this issue Jun 29, 2015
Fixes #1 #2 #3. Also breaks all other intervals, since they need to have a
ceiling function now, too. Also doesn’t fix day.offset, but I’m not totally sure
that’s fixable yet and if so what the behavior should be.
@mbostock
Copy link
Member Author

This appears to be fixed in Chrome and Firefox (per #1).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant