Comments (4)
Interesting question... By the way, you're talking about this (type: "number"
) right?
In date format, we can have several fields in the same output. As a developer, we should to be able to identify them, e.g., let's say we need to add a markup to the month part, which could be "dd/MM"
in en-GB or "M/d"
in en-US.
In relative time format, the output takes two forms: (a) it includes a literal part (the message) and a number that indicates a relative distance in a certain unit, (b) the message itself is the verbose relative distance (e.g., today). In the future, relative time format could potentially include a mix of things, e.g., "tomorrow afternoon" (not even considered here, but considered in ICU).
Always using "number" seems inappropriate given (a) and (b) above alone.
Do we want to differentiate the "Tomorrow"
type from the "2"
type in "in 2 days"
? I mean, would we use day
for both or two different types? Making a parallel with date, the type of "1"
or "January"
are both month
), so perhaps not; but note that in date format the developer knows in advance what to expect (i.e., they know the output will always by a number or a text given the formatter style, e.g., month: 2-digit). In relative time, one type of message or the other depends on message-availability given value
, e.g., "2 days ago"
vs. "anteontem"
both represent (-2, day)
, the first in en, the second in pt. Develop doesn't know what to expect in advance if we use day
for both forms. I'm only thinking out loud here...
from proposal-intl-relative-time.
I was assuming we'd get "literal"
for "tomorrow"
or "anteotem"
, and just get "number"
/"day"
for the number "2"
. I'm not sure how much work it will be, as well, to separate out different parts of a worded message--if CLDR even has data for this.
from proposal-intl-relative-time.
cc @zbraniecki
from proposal-intl-relative-time.
+1 on using "literal" here.
from proposal-intl-relative-time.
Related Issues (20)
- Docs(MDN) : Intl.RelativeTimeFormat HOT 9
- Update status on README
- Handle cut-off logic / distance with a given Date HOT 5
- Accept BigInt in format/formatToParts HOT 2
- Ambiguous Polyfills section in docs HOT 2
- Add an option to remove the prefix HOT 2
- It would be nice to document the expected placeables in the pattern. HOT 5
- request New API for format relative time from now HOT 5
- Review @@toStringTag value HOT 1
- "an optional argument value" HOT 1
- Remove references to InitializedIntlObject HOT 3
- Create options objects with null proto HOT 1
- Question: why is minimumIntegerDigits set to 2? HOT 6
- Question: What about other NumberFormat options? HOT 2
- resolvedOptions does not need undefined check
- isFinite() does not seem to be formally defined HOT 1
- Review handling of "narrow" style HOT 6
- Incorrect "yesterday" examples HOT 6
- PartitionRelativeTimePattern accepts non-time values HOT 1
- Allow to modify the numbering system through "nu"? HOT 8
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-relative-time.