Provides fuzzy timestamps by formatting dates as "time ago" (for example, 3 hours ago).
<script async custom-element="amp-timeago" src="https://cdn.ampproject.org/v0/amp-timeago-0.1.js"></script>
Use the amp-timago component to count up to, or away from, a specified date and time.
The component replaces the text node with a fuzzy timestamp, such as
in 30 years or
3 hours ago.
If using the
cutoff attribute, and time has past the cutoff, the text node will display the specified date in the
<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 >
amp-timeago component requires a placeholder in the text node. The calculated timestamp replaces the placeholder once ready. Use the placeholder as a fallback to display to users if
amp-timeago is unable to process the fuzzy timestamp.
|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
|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.|
See amp-timeago rules in the AMP validator specification.
You've read this document a dozen times but it doesn't really cover all of your questions? Maybe other people felt the same: reach out to them on Stack Overflow.Go to Stack Overflow Found a bug or missing a feature?
The AMP project strongly encourages your participation and contributions! We hope you'll become an ongoing participant in our open source community but we also welcome one-off contributions for the issues you're particularly passionate about.Go to GitHub