open-pod/lib/podcast_feed_web/views/feed_view.ex

10 lines
241 B
Elixir
Raw Normal View History

2020-05-22 22:04:15 +02:00
defmodule PodcastFeedWeb.FeedView do
use PodcastFeedWeb, :view
def format_length(length) do
2020-05-24 23:01:58 +02:00
min = length / 60 |> trunc()
2020-05-24 23:13:17 +02:00
sec = length - (min * 60) |> Integer.to_string |> String.pad_leading(2, "0")
2020-05-22 22:04:15 +02:00
"#{min}:#{sec}"
end
end