Skip to content

seanzi86/vue-timy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Installation

1 Install via npm

npm install vue-timy

2 Import and use vue-timy

2a. Without options

import Vue from 'vue';
import timy from 'vue-timy';

// Use vue-timy
Vue.use(timy);

2b. With custom formats.

import Vue from 'vue';
import timy from 'vue-timy';

//The following options can be overridden.
var options = {
  justNow: "Just now",
  aFewSecondsAgo: "A few seconds ago",
  secondsAgo: "seconds ago",
  aMinuteAgo: "A minute ago",
  minutesAgo: "minutes ago",
  anHourAgo: "An hour ago",
  hoursAgo: "hours ago",
  aDayAgo: "A day ago",
  daysAgo: "days ago",
  aWeekAgo: "A week ago",
  weeksAgo: "weeks ago",
  aMonthAgo: "A month ago",
  monthsAgo: "months ago",
  aYearAgo: "A year ago",
  yearsAgo: "years ago"
};

// Use vue-timy with custom formats
Vue.use(timy, options);

3 Reference in your component templates

<template>
  <timy :date="theDate" />
</template>
<script>
export default {
  data() {
    return {
      theDate: new Date()
    };
  }
};
</script>

About

A simple time ago Vue component. Based on https://github.com/Chalarangelo/timy.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published