Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to specify ListFormat instance options #14

Closed
ryzokuken opened this issue May 29, 2020 · 9 comments
Closed

How to specify ListFormat instance options #14

ryzokuken opened this issue May 29, 2020 · 9 comments
Labels
consensus We reached a consensus in a discussion meeting, through email or the issue discussion Meeting Discussion Need to be discussed in one of the upcoming meetings

Comments

@ryzokuken
Copy link
Member

ryzokuken commented May 29, 2020

We have encapsulated a ListFormat instance inside DurationFormat in order to format the different duration components as a single list. How should we allow users to specify options for constructing that instance? Here are our options.

1. Don't specify any options for the instance.

Don't specify any options at all. Just instantiate a vanilla ListFormat with the same locale.

2. Implicit passthrough

Implicitly passthrough the options argument to the ListFormat constructor.

3. Explicit

Explicitly specify options for the ListFormat constructor, via an additional option listFormatOptions.

/cc @littledan @younies @sffc

Reference: #11 (comment)

@littledan
Copy link
Member

My guess was that 2. would give the semantics we generally want. 1 seems broken, and 3 seems overkill/hard to use (but maybe there's some use case for it that I'm missing?).

@sffc
Copy link
Collaborator

sffc commented May 29, 2020

Related: tc39/ecma402#422

I would prefer that we set the width of the ListFormat to match the width of the DurationFormat (long->long, short->short, narrow->narrow), and otherwise don't bubble up any other settings. I think this covers the 90% use case. When tc39/ecma402#422 is resolved, we can consider amending Intl.DurationFormat to pass down options in a similar way.

@ryzokuken
Copy link
Member Author

@sffc that seems like exactly what Daniel had proposed, so I guess we can get consensus on that behavior.

@younies younies added the Meeting Discussion Need to be discussed in one of the upcoming meetings label Jun 15, 2020
@younies
Copy link
Member

younies commented Jun 15, 2020

@ryzokuken , thanks for bringing this issue
I would prefer option 2. However, some options could not be populated directly, for example style: "dotted",

Therefore, let's discuss this issue next meeting and try to have a consensus about it.

@sffc
Copy link
Collaborator

sffc commented Jun 15, 2020

FYI: Under the hood, the "dotted" form does not actually use ListFormat, or at least that form is not available as a general purpose ListFormat pattern.

@ryzokuken
Copy link
Member Author

Yes, the ListFormat is used for all forms other than "dotted".

@younies
Copy link
Member

younies commented Jun 15, 2020

Yes, therefore, we could not pass this argument directly to ListFormat

@ryzokuken
Copy link
Member Author

@younies actually, the opposite. In the case of "dotted", we don't even construct a ListFormat so it's not really a problem to pass the argument directly to ListFormat.

@younies
Copy link
Member

younies commented Aug 24, 2020

We have consensus on option 2.

@younies younies closed this as completed Aug 24, 2020
@younies younies added the consensus We reached a consensus in a discussion meeting, through email or the issue discussion label Aug 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
consensus We reached a consensus in a discussion meeting, through email or the issue discussion Meeting Discussion Need to be discussed in one of the upcoming meetings
Projects
None yet
Development

No branches or pull requests

4 participants