Comments (9)
A reduction of this issue (requires switching to Brasilia Standard Time):
date = new Date("2017-10-08T03:00:00.000Z") // Date 2017-10-08T03:00:00.000Z
d3.timeWeek(date) // Date 2017-10-08T03:00:00.000Z
d3.timeWeek.offset(date, 1) // Date 2017-10-15T02:00:00.000Z
d3.timeWeek(d3.timeWeek.offset(date, 1)) // Date 2017-10-08T03:00:00.000Z
from d3-time.
Actually, it’s even worse in that d3.timeWeek is not idempotent:
date = new Date("2017-10-15T03:00:00.000Z") // Date 2017-10-15T03:00:00.000Z
d3.timeWeek(date) // Date 2017-10-15T02:00:00.000Z
d3.timeWeek(d3.timeWeek(date)) // Date 2017-10-08T03:00:00.000Z
from d3-time.
In vanilla JavaScript (Firefox):
date = new Date("2017-10-15T03:00:00.000Z") // Date 2017-10-15T03:00:00.000Z
date.setHours(0, 0, 0, 0) // Date 2017-10-15T02:00:00.000Z
date.setHours(0, 0, 0, 0) // Date 2017-10-14T03:00:00.000Z
Whereas in Chrome:
date = new Date("2017-10-15T03:00:00.000Z") // Date 2017-10-15T03:00:00.000Z
date.setHours(0, 0, 0, 0) // Date 2017-10-15T03:00:00.000Z
date.setHours(0, 0, 0, 0) // Date 2017-10-15T03:00:00.000Z
So in other words, calling date.setHours in Firefox is changing the date from the 15th to the 14th.
from d3-time.
(d3.timeDay is also not idempotent in Firefox, for the same reasons.)
from d3-time.
I’m not sure it’s feasible to return the correct result in Firefox; in general, D3 is not a compatibility layer, so I rarely try to workaround a bug in date.setHours (and I think this counts as a bug… although perhaps I am misreading the spec). That said, if there’s a reasonably simple workaround, I’d be amenable to using it—I just can’t think of one immediately.
I’d also like to guarantee that interval.range can’t go into an infinite loop, but I think that would still mean that Firefox would have incorrect results. I’ll change this issue title accordingly.
from d3-time.
Any plans to make a new release soon with this patch?
from d3-time.
Thanks for the reminder. Will try to do this soon…
from d3-time.
Is there any update on this? We are blocked on releasing a project as this is still a problem with Firefox 57. Thank you!
from d3-time.
Will try today. Thanks for the reminder.
from d3-time.
Related Issues (20)
- Visualizing data based on Hijri date series HOT 2
- Filtered intervals' offset() function doesn't work correctly when step is negative HOT 1
- bug where the same dates are not recognised as the same as each other (==), but are also not recognised as either less then or more then the other! HOT 2
- Visualizing date based on Hijri date series HOT 2
- timeMinute, timeHour are sometimes wrong (Chrome 67). HOT 10
- Tick format for dates before 1900-01-01 rendered as ":00" HOT 1
- interval.range function fails for Day interval when crossing daylight savings time in Brazilian time zone. HOT 1
- d3.timeMonth.offset() returns not the best thing for final days of the month HOT 1
- Hope to add timeQuarter HOT 3
- rangeInclusive HOT 4
- range in descending order? HOT 2
- Week starts on Monday HOT 1
- Half years for time axis HOT 2
- interval.every and interval.range generate different result with the same step
- interval.range() with option to include the stop interval boundary HOT 2
- infinite loop on _interval_.filter HOT 2
- Request: export `ticker` HOT 1
- Equivalent of d3.unixDay for local time HOT 1
- interval.every can return intervals of inconsistent length HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from d3-time.