Comments (7)
I have noticed that date.toLocaleString is extremely slow, but perhaps browser vendors haven’t realized that and will make performance improvements as it is adopted by web developers.
from d3-time-format.
Since there is no standard for parsing dates (yet), it probably makes sense to retain part of this library as a D3 module that only implements parsing (not formatting). But I think it should be optional as most people should be using ISO 8601 to represent machine-readable dates and not using arbitrary localized formats in local time.
We also probably want a strict ECMAScript IEEE 8601 date parser in d3-time or somewhere central, and probably a shorthand formatter as well, since browser support for that is not quite where it should be and there is still an active TC39 proposal to standardize the behavior of Date.parse.
from d3-time-format.
Here are the relevant bits from d3-dsv to parse and format ECMAScript dates strictly:
https://github.com/d3/d3-dsv/blob/ff2d09f943c2d19d0f0fa96f9b6a39c7431ca7e8/src/autoType.js#L9
https://github.com/d3/d3-dsv/blob/ff2d09f943c2d19d0f0fa96f9b6a39c7431ca7e8/src/dsv.js#L47
from d3-time-format.
FWIW, date.toLocaleString
seems to have pretty good coverage - everything except Android webview.
from d3-time-format.
Unfortunately date.toLocaleString is far too slow for many applications (e.g., when formatting thousands of dates for static tooltips). But I haven’t yet tested whether creating an Intl.DateTimeFormat instance would be faster. If it is, that may be a viable replacement for this library.
from d3-time-format.
A benchmark would be good to have on hand, so we could easily check if browser vendors make performance improvements. Is there an example you know of that demonstrates or measures the slowness?
from d3-time-format.
I think this library still serves a purpose, at least as far as parsing goes, and it’s nice to have symmetry with formatting. Therefore closing this issue.
from d3-time-format.
Related Issues (20)
- Parser returned from timeParse returns a different time zone HOT 1
- Time formats in d3
- Missing Semester HOT 4
- Cannot require() starting with version 4 HOT 3
- How do I get at the locales? HOT 1
- Doc: %S range HOT 3
- %Z behavior does not match strftime HOT 2
- timezone without 00, e.g +08 , instead of +0800? HOT 1
- d3.timeFormat("%Y-%U") return value is inconsistent with python 3 strftime for "2023-01-01" HOT 6
- numeric month without leading 0 HOT 1
- formatUTCWeekNumberISO and formatWeekNumberISO return incorrect results at edge of the year HOT 4
- Year support for "10000" HOT 2
- JSON of locale need no-periods attribute HOT 3
- Parsing Negative Unix Values Fail HOT 1
- remove dev dependency on d3-queue
- Invalid string parses but results in unexpected date HOT 1
- Full ISO 8601 support?
- ISO week year (%g and %G) parsing and formatting is inconsistent.
- ch
- Locale files not exported 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-format.