Description Provides fuzzy timestamps by formatting dates as `*** time ago` (for example, 3 hours ago).
Required Script <script async custom-element="amp-timeago" src="https://cdn.ampproject.org/v0/amp-timeago-0.1.js"></script>
Supported Layouts fixed, fixed-height, responsive

Behavior

Provides fuzzy timestamps that you can use on your AMP pages. This component is based on timeago.js.

Example:

<amp-timeago layout="fixed" width="160"
    height="20"
    datetime="2017-04-11T00:37:33.809Z"
    locale="en">Saturday 11 April 2017 00.37</amp-timeago>

Attributes

datetime (required)

An ISO datetime. E.g. 2017-03-10T01:00:00Z (UTC) or 2017-03-09T20:00:00-05:00 (specifying timezone offset).

locale (optional)

By default, the local is set to en; however, you can specify one of the following locales:

  • ar (Arabic)
  • be (Belarusian)
  • bg (Bulgarian)
  • ca (Catalan)
  • da (Danish)
  • de (German)
  • el (Greek)
  • en (English)
  • enShort (English - short)
  • es (Spanish)
  • eu (Basque)
  • fi (Finnish)
  • fr (French)
  • he (Hebrew)
  • hu (Hungarian)
  • inBG (Bangla)
  • inHI (Hindi)
  • inID (Malay)
  • it (Italian)
  • ja (Japanese)
  • ko (Korean)
  • ml (Malayalam)
  • nbNO (Norwegian Bokmål)
  • nl (Dutch)
  • nnNO (Norwegian Nynorsk)
  • pl (Polish)
  • ptBR (Portuguese)
  • ro (Romanian)
  • ru (Russian)
  • sv (Swedish)
  • ta (Tamil)
  • th (Thai)
  • tr (Turkish)
  • uk (Ukrainian)
  • vi (Vietnamese)
  • zhCN (Chinese)
  • zhTW (Taiwanese)
cutoff (optional)

Display the original date if time distance is older than cutoff (seconds).

common attributes

This element includes common attributes extended to AMP components.

Validation

See amp-timeago rules in the AMP validator specification.