A simple "x days ago" component for Vue, using the html
time
tag.
- Be as lightweight as possible
- Use HTML
time
tags
The basics of this package come from this gist.
There is no included CSS, but you may use the .time
class for styling.
This is totally personal preference, but I like the look of the following:
.time {
margin-left: .5em;
font-weight: normal;
font-style: italic;
}
This looks pretty good next to user names and such.
Name | Type | Default | Description |
---|---|---|---|
date |
Date | new Date() |
A JS Date object of the time you wish to represent. |
interval |
Number | 5000 |
How often in milliseconds to update the timestamp. |
timeLimit |
Number | 3600 |
If the difference between date and the current time is greater then timeLimit (in seconds), polling will not occur in order to save computation time. |