Adding a conditional to the pipeline


  def eta() do
    result = @dday
        |> Timex.diff(NaiveDateTime.utc_now(), :duration)
        |> Timex.format_duration(:humanized)
    if String.contains?(result, "sec") do
      result
    else
      String.replace(result, "minutes", "minutes, 0 seconds")
    end
  end

seems like this should be part of the same pipeline but idk how to pull it off (if its even possible)

Check out then, it’s used in exactly such situations.

1 Like