2020-05-22 22:04:15 +02:00
|
|
|
defmodule PodcastFeedWeb.FeedView do
|
|
|
|
use PodcastFeedWeb, :view
|
|
|
|
|
|
|
|
def format_length(length) do
|
2020-05-23 23:51:56 +02:00
|
|
|
length |> IO.inspect
|
2020-05-22 22:04:15 +02:00
|
|
|
parsed = length / 100 / 60
|
|
|
|
min = parsed |> trunc
|
|
|
|
sec = parsed - min |> Float.floor(2) |> Float.to_string() |> String.split(".") |> Enum.at(1)
|
|
|
|
"#{min}:#{sec}"
|
|
|
|
end
|
|
|
|
end
|