IHP Api Reference
Copyright(c) digitally induced GmbH 2020
Safe HaskellNone

IHP.View.TimeAgo

Description

 
Synopsis

Documentation

timeAgo :: UTCTime -> Html Source #

Display time like 5 minutes ago

Render's a <time> HTML-Element. Will be displayed like 5 minutes ago, 1 day ago, etc..

Requires the javascript helpers to be available. Then the time will displayed in the current browser timezone.

When the js helper is not available, the time will be displayed with the format: DD.MM.YYYY, HH:MM

Example: Generated HTML

>>> <div>{timeAgo (project.createdAt)}</div>
<div><time class="time-ago">31.08.2007, 16:47</time></div>

Example: HTML after javascript helpers have been applied

>>> <div>{timeAgo (project.createdAt)}</div>
<div><time class="time-ago">a while ago</time></div>

dateTime :: UTCTime -> Html Source #

Display time like 31.08.2007, 16:47

Render's a <time> HTML-Element for displaying time and date.

Requires the javascript helpers to be available. Then the date and time will displayed in the current browser timezone.

The js helper uses toLocaleDateString to display the date in the browsers locale format.

Example: Generated HTML

>>> <div>{dateTime (project.createdAt)}</div>
<div><time class="date-time">31.08.2007, 16:47</time></div>

Example: HTML after javascript helpers have been applied

>>> <div>{dateTime (project.createdAt)}</div>
<div><time class="date-time">31.08.2007, 16:47 Uhr</time></div>

date :: UTCTime -> Html Source #

Display date like 31.08.2007

Render's a <time> HTML-Element for displaying the date.

Requires the javascript helpers to be available. Then the date will displayed in the current browser locale format and timezone.

The js helper uses toLocaleDateString to display the date in the browsers locale format.

Example: Generated HTML

>>> <div>{date (project.createdAt)}</div>
<div><time class="date">31.08.2007, 16:47</time></div>

Example: HTML after javascript helpers have been applied

>>> <div>{date (project.createdAt)}</div>
<div><time class="date">31.08.2007</time></div>

time :: UTCTime -> Html Source #

Display time like 16:47

Render's a <time> HTML-Element for displaying the time.

Requires the javascript helpers to be available. Then the time will displayed in the current browser timezone.

The js helper uses toLocaleDateString to display the date in the browsers locale format.

Example: Generated HTML

>>> <div>{time (project.createdAt)}</div>
<div><time class="time">16:47</time></div>

Example: HTML after javascript helpers have been applied

>>> <div>{time (project.createdAt)}</div>
<div><time class="time">16:47 Uhr</time></div>