public class AmpTimeago extends AmpComponent
Provides fuzzy timestamps by formatting dates as "X time ago"
Constructor and Description |
---|
AmpTimeago(Date dateTime)
Create instance of AmpTimeago.
|
AmpTimeago(Date dateTime,
int width,
int height)
Create instance of AmpTimeago.
|
Modifier and Type | Method and Description |
---|---|
int |
getCutoff()
Display the original date if time distance is older than cutoff (seconds).
|
Date |
getDateTime()
A datetime.
|
String |
getLocale()
By default, the local is set to en; however, you can specify other locales.
|
String |
getRequiredScript()
Required script that muct be added to head section.
|
void |
setCutoff(int value)
Display the original date if time distance is older than cutoff (seconds).
|
void |
setDateTime(Date value)
A datetime.
|
void |
setLocale(String value)
By default, the local is set to en; however, you can specify other locales.
|
String |
toAmpHtml()
Represents amp html version of component.
|
String |
toHtml()
Represents html version of component.
|
getAttributes, getFallback, getPlaceholder, setFallback, setPlaceholder
public AmpTimeago(Date dateTime)
Create instance of AmpTimeago.
dateTime
- public AmpTimeago(Date dateTime, int width, int height)
Create instance of AmpTimeago.
dateTime
- width
- height
- public final Date getDateTime()
A datetime.
public final void setDateTime(Date value)
A datetime.
public final String getLocale()
By default, the local is set to en; however, you can specify other locales. See full list of supported locales https://amp.dev/documentation/components/amp-timeago/?format=email
public final void setLocale(String value)
By default, the local is set to en; however, you can specify other locales. See full list of supported locales https://amp.dev/documentation/components/amp-timeago/?format=email
public final int getCutoff()
Display the original date if time distance is older than cutoff (seconds).
public final void setCutoff(int value)
Display the original date if time distance is older than cutoff (seconds).
public String getRequiredScript()
Required script that muct be added to head section.
getRequiredScript
in class AmpComponent
public String toAmpHtml()
Represents amp html version of component.
toAmpHtml
in class AmpComponent
public String toHtml()
Represents html version of component.
toHtml
in class AmpComponent