BitstylesPhoenix.Time (bitstyles_phoenix v0.8.0) View Source

Time-related UI components

Link to this section Summary

Functions

Renders dates & times in a manner readable and expressive for both humans and machines.

Link to this section Functions

Link to this function

ui_time(human_time, machine_time)

View Source

Renders dates & times in a manner readable and expressive for both humans and machines.

human_time — the string you want your human visitors to see machine_time — the UTC-formatted datetime string, with timezone.

A time

iex> safe_to_string ui_time("15:17", "2020-11-10 14:17:32Z")
~s(<time datetime="2020-11-10 14:17:32Z" title="2020-11-10 14:17:32Z">15:17</time>)

A date

iex> safe_to_string ui_time("2020-11-18", "2020-11-18 14:23:14Z")
~s(<time datetime="2020-11-18 14:23:14Z" title="2020-11-18 14:23:14Z">2020-11-18</time>)