I don't think I would worry about precision shortcuts for those APIs: 1. You can truncate after anyway. If the precision is not relevant to the operation, then after should have the same result. If it is important, then you want to either leave it or be explicit 2. Some operations don't return a Date/Time and therefore may not care about precision either
*José Valimhttps://dashbit.co/ <https://dashbit.co/>* On Wed, Jan 8, 2025 at 7:55 PM Wojtek Mach <woj...@wojtekmach.pl> wrote: > Btw, one of somewhat recent nice ergonomic improvement was replacing: > > DateTime.utc_now() |> DateTime.truncate(:second) > > with: > > DateTime.utc_now(:second) > > I think it might be relevant for the proposal. Is either of these > appealing? > > # option 1 > DateTime.from_utc_now(:seconds, hour: 1) > # option 2 > DateTime.from_utc_now([hour: 1], :seconds) > > On the other hand, do we instead add :utc_now, :utc_now_seconds, and > possibly others? I’m not sure. > > If supporting precision is important, to me > DateTime.from_utc_now(duration, precision \\ :microsecond) feels like the > best option after all. > > > > -- > You received this message because you are subscribed to the Google Groups > "elixir-lang-core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to elixir-lang-core+unsubscr...@googlegroups.com. > To view this discussion visit > https://groups.google.com/d/msgid/elixir-lang-core/8BC8C9BF-BA83-49A0-BD07-91E789B3BAE8%40wojtekmach.pl > . > -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4Lk%3Dgq3PDNdO5Turtc6phMD_AwZPT%2BH%2B440iSGZ5TsUag%40mail.gmail.com.