3 ms·
Also plain old ActiveSupport. It doesn't have the natural language goodies, but it has all kinds of handily named methods, e.g. you can write (functional folks
by Toutouxc 5y ago
Also plain old ActiveSupport. It doesn't have the natural language goodies, but it has all kinds of handily named methods, e.g. you can write (functional folks may want to look away)
3.weeks.ago.next_month.beginning_of_month.last_weekday.end_of_day
and it resolves to 2021-10-29 23:59:59.9999 as of today.
- pmontra 5y agoFunctional folks could write that in Elixir as {:ok, end_of_november} = 3 ¦> weeks ¦> ago ¦> next_month ¦> beginning_of_month ¦> last_weekday ¦> end_of_day given the appropriate function declarations accepting at least either a number or a DateTime or some intermediate data structure as argument.