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

FixedDecimalFormatter and WeekCalculator should be conditionally loaded in datetime #4340

Open
sffc opened this issue Nov 20, 2023 · 10 comments
Assignees
Labels
C-datetime Component: datetime, calendars, time zones S-small Size: One afternoon (small bug fix or enhancement)

Comments

@sffc
Copy link
Member

sffc commented Nov 20, 2023

#4204 landed DateTimePatternInterpolator that always loads a FixedDecimalFormatter. Most patterns need one. However, not all patterns do, such as patterns that seek standalone display names. So should we make the FixedDecimalFormatter optional?

Maybe add a new constructor like try_new_without_fixed_decimal_formatter?

@sffc sffc added discuss Discuss at a future ICU4X-SC meeting C-datetime Component: datetime, calendars, time zones labels Nov 20, 2023
@sffc
Copy link
Member Author

sffc commented Nov 30, 2023

Bikeshed for the function name:

  • try_new_without_fixed_decimal_formatter
  • try_new_without_decimals
  • try_new_without_number_formatting
  • try_new_bare

Opinion @zbraniecki @Manishearth @robertbastian ?

@sffc sffc added needs-approval One or more stakeholders need to approve proposal and removed discuss Discuss at a future ICU4X-SC meeting labels Nov 30, 2023
@Manishearth
Copy link
Member

3 > 2 > 1 >> 4

@robertbastian
Copy link
Member

So what happens if you need a FDF but used this constructor? I like the try_new_without_number_formatting concept, but then it should do naive fixed decimal formatting instead of erroring.

@sffc
Copy link
Member Author

sffc commented Dec 1, 2023

It would have the same behavior as if you gave the DateTimePatternInterpolator a pattern that needs abbreviated month names but you didn't load abbreviated month names (returns a MissingDateNames error).

@robertbastian
Copy link
Member

robertbastian commented Dec 7, 2023

3 > 1 > 2 >> 4

@Manishearth
Copy link
Member

Zibi also suggested try_new_without_numbers in the meeting

@sffc
Copy link
Member Author

sffc commented Mar 19, 2024

Ballots: https://docs.google.com/document/d/1cwObpQ_gdCsoZVEDNV7C-7eODxElGIJ3FNdivlbLnNo/edit

Results: Option 3, try_new_without_number_formatting, wins. It is the first choice of 5 of 6 ballots and has no vetoes.

@sffc sffc removed the needs-approval One or more stakeholders need to approve proposal label Mar 19, 2024
@sffc sffc added this to the 1.5 Blocking ⟨P1⟩ milestone Mar 19, 2024
@sffc sffc self-assigned this Mar 19, 2024
@sffc sffc added the S-small Size: One afternoon (small bug fix or enhancement) label Mar 19, 2024
@sffc sffc modified the milestones: 1.5 Blocking ⟨P1⟩, ICU4X 2.0 May 23, 2024
@sffc
Copy link
Member Author

sffc commented Sep 17, 2024

Could possibly be done with field sets.

@sffc sffc changed the title Should DateTimePatternInterpolator always load a FixedDecimalFormatter? FixedDecimalFormatter and WeekCalculator should be conditionally loaded in datetime Oct 2, 2024
@sffc
Copy link
Member Author

sffc commented Oct 13, 2024

I'm opening a PR where I do this for DateTimeNames.

It's not immediately clear to me how to do this for field sets via the type system. I think I need the trait to optionally take a FixedDecimalFormatterLoader, but that is not currently public, and I've gotten pushback before when I tried to make the cross-crate loader stuff public. So, I would like to move the field set portion of this issue out of the 2.0 milestone. I propose putting it in Backlog.

@Manishearth
Copy link
Member

fine by me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-datetime Component: datetime, calendars, time zones S-small Size: One afternoon (small bug fix or enhancement)
Projects
Status: Unclaimed for sprint
Development

No branches or pull requests

3 participants