Comments (8)
Because of 1 and 2, the case for having them in the API isn't very strong.
I don't understand that statement. How is the fact that a display name of a month in gregorian calendar never changes related to whether it's a good idea to expose it directly via Intl.DisplayNames
?
Item 3 shows a major drawback to including them: their presence may entice uninformed developers to try to build their own date formatters, which would almost certainly be less correct and less performant than the date formatters already present in JavaScript.
I don't understand that statement. Intl.DateTimeFormat
formats the date. Intl.DisplayNames
exposes display names of some tokens. I don't see how any user would take an output of DisplayNames and attempt to construct datetime formatted pattern out of it instead of using Intl.DateTimeFormat
for that.
from proposal-intl-displaynames.
It reduces the number of sources of truth from “every website” to “every browser/engine” - imo that’s a strong enough argument due to the lessened likelihood of the info being wrong.
from proposal-intl-displaynames.
This seems like a "philosophical" disagreement: do we withhold tools from users because we fear that they might be misused, or do we give them the tools and trust that programmers know to do the right thing? It's not too different from Intl.Segmenter line-type (tc39/proposal-intl-segmenter#49).
For what it's worth, I tend to prefer to expose all of the tools, but help the programmer by making the "right way" of doing things easier than the "wrong way". Intl.DateTimeFormat is already stable and extremely easy to use via Date.prototype.toLocaleString
, which meets this mark, so on this particular issue I prefer exposing the date symbols.
from proposal-intl-displaynames.
As a use case, this feature allows implementing custom compact multilingual datetime selectors without headache. Shipping this data with component will increase its size by ~5-10 KiB (for each language) of gzipped size; I think it’s too much for one UI component.
Also, are Gregorian months enough? Why not consider 'month#'
syntax (as for quarters)?
What about eras, Chinese zodiac?
from proposal-intl-displaynames.
Every API can be abused; this issue is not about withholding every API that has any possibility of abuse. Instead, this is about how likely abuse will be. An API that is easier to abuse than use correctly wouldn’t be a good API. I’m not claiming that dateSymbol
is easier to abuse than not; just that the balance is perhaps too close.
I was responding to an argument made in the most recent telecon about how this API allows every website can be automatically updated when these strings change. The dateSymbol
strings almost never change, so that argument isn’t particularly strong in this case.
from proposal-intl-displaynames.
Would this be worth discussing in an ECMA-402 meeting? Or have you concluded to remove these strings?
from proposal-intl-displaynames.
Close this issue based on ecma402 meeting conclusion
from proposal-intl-displaynames.
@FrankYFTang Could you summarize that conclusion here?
from proposal-intl-displaynames.
Related Issues (20)
- The number of types stated in the Internal Slot should be "nine" instead of "six" HOT 1
- Indexing month names for leap month HOT 11
- Change the "month" and "weekday" type to 0-based index from 1-based HOT 12
- Intl.DisplayNames payload HOT 3
- Docs(MDN) : Intl.DisplayNames HOT 1
- Weekday or dayOfWeek? HOT 4
- Need to add Oxford comma after "Number"
- Suspicious handling of numeric code in Intl.DisplayNames.prototype.of() HOT 4
- Support name of the Numbering System HOT 2
- Support calendar display names HOT 2
- Canonicalise language, script, and region tags HOT 1
- Input conversion for language tags inconsistent with CanonicalizeLocaleList HOT 1
- Change Intl.DisplayNames.prototype.of to return the "code" fallback in canonical case?
- Should "type" be changed to a mandatory option instead of defaulting it to "language"? HOT 7
- Consider adding abbreviated length HOT 5
- Add "weekday" and "month" display names HOT 3
- Add applicable options to the "Conformance" section HOT 2
- unicode_language_id's `_` separator and the implementations in the wild HOT 6
- Should we map the code if the type is region ? HOT 10
- Should we map the code if the type is script ? HOT 2
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 proposal-intl-displaynames.