Skip to content

srcrip/vue-timestamp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vue-timestamp

A simple "x days ago" component for Vue, using the html time tag.

Project goals:

  1. Be as lightweight as possible
  2. Use HTML time tags

The basics of this package come from this gist.

CSS

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.

Props

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.

About

A simple "x days ago" component for Vue.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published