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 (get #createdAt project)}</div>
<div><time class="time-ago">31.08.2007, 16:47</div>

Example: HTML after javascript helpers have been applied

>>> <div>{timeAgo (get #createdAt project)}</div>
<div><time class="time-ago">a while ago</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 (get #createdAt project)}</div>
<div><time class="date-time">31.08.2007, 16:47</div>

Example: HTML after javascript helpers have been applied

>>> <div>{dateTime (get #createdAt project)}</div>
<div><time class="date-time">31.08.2007, 16:47 Uhr</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 (get #createdAt project)}</div>
<div><time class="date">31.08.2007, 16:47</div>

Example: HTML after javascript helpers have been applied

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