BitstylesPhoenix.Time (bitstyles_phoenix v0.4.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
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>)