Coder Social home page Coder Social logo

Comments (7)

icambron avatar icambron commented on June 16, 2024 1

-1. It isn't supported by the Intl.NumberFormat class, so I don't think it would make sense to support it just for relative time. I'm sure it was discussed when making Intl.NumberFormat and I don't know why they declined to add it, but if I had to guess:

  1. Those style guides are about using numbers in prose. It's not clear to me that they apply to the most common use cases for Javascript number formatting.
  2. The rules are complicated, e.g. both the major en-US style guides have rules like "if it's at the beginning of a sentence, write it out"
  3. The rules are varied. The sytle guides do not, in fact, agree about stuff like this, even for a specific language. For example, the Chicago Manual wants words for up to 100, whereas the AP guide says 1-10.

from proposal-intl-relative-time.

zbraniecki avatar zbraniecki commented on June 16, 2024 1

There's an API for spelling out numbers - http://userguide.icu-project.org/formatparse/numbers/rbnf-examples

Not sure if we want to aim to extend numberformat and this with it in the future but may be worth trying to figure out how such API might look like

from proposal-intl-relative-time.

littledan avatar littledan commented on June 16, 2024

@kdex Thanks for coming here and explaining this issue. Given that this proposal is already at Stage 3 in TC39, would you be up for revisiting it as a possible "v2" feature to come after Intl.RelativeTimeFormat ships?

from proposal-intl-relative-time.

 avatar commented on June 16, 2024

@icambron Thanks a lot for the detailed explanation. As for (1), I would think that there's lots of good applications for using Intl to construct prose. I fully understand (2) and (3) though.

@littledan In general, yes, I'm up for revisiting this, but I'm not sure what the extent of such an feature would entail, as written out numbers aren't necessarily unique. Consider 101:

  • one hundred and one
  • a hundred and one
  • one hundred one
  • a hundred one

I'm very drawn to say that, if anything, we might want to extend Intl.NumberFormat to allow writing out numbers, and only then would revisiting this in Intl.RelativeTimeFormat make sense.

from proposal-intl-relative-time.

littledan avatar littledan commented on June 16, 2024

@kdex In general, this standard has been not innovating on internationalization data itself but instead following the patterns of other libraries and databases such as CLDR and ICU, and exposing something similar to JavaScript. I'd recommend working in one of those places to solve the underlying problem, and then figure out how to map the solution to JavaScript.

from proposal-intl-relative-time.

 avatar commented on June 16, 2024

@littledan Thanks a lot for the pointers; I'll be closing this issue for now.

from proposal-intl-relative-time.

littledan avatar littledan commented on June 16, 2024

@kdex Feel free to check back here or at #tc39 on irc.freenode.net if you need to reach us for any more discussion.

from proposal-intl-relative-time.

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.