Giter Club home page Giter Club logo

Comments (8)

zbraniecki avatar zbraniecki commented on May 13, 2024 3

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.

ljharb avatar ljharb commented on May 13, 2024 2

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.

sffc avatar sffc commented on May 13, 2024 1

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.

miyaokamarina avatar miyaokamarina commented on May 13, 2024 1

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.

litherum avatar litherum commented on May 13, 2024

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.

littledan avatar littledan commented on May 13, 2024

Would this be worth discussing in an ECMA-402 meeting? Or have you concluded to remove these strings?

from proposal-intl-displaynames.

FrankYFTang avatar FrankYFTang commented on May 13, 2024

Close this issue based on ecma402 meeting conclusion

from proposal-intl-displaynames.

littledan avatar littledan commented on May 13, 2024

@FrankYFTang Could you summarize that conclusion here?

from proposal-intl-displaynames.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.