npm

@vuecs/timeago
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

@vuecs/timeago ⏰

npm version CI

A package containing a timeago component.

Table of Contents

Installation

$ npm i --save @vuecs/timeago

Usage

Register the plugin.

import install from '@vuecs/timeago';
import { createApp } from 'vue'

const app = createApp({})

app.use(install, {
    /* set the default locale */
    locale: 'en',
});

After the component is registered, it can be used as follows.

<template>
    <VCTimeago
        :date-time="1684746631769"
        :locale="'en'"
        :auto-update="true"
    />
</template>

Locales

To support other locales, the corresponding locale object must be imported from the date-fns library. In the following, this will be shown for the german language.

import install from '@vuecs/timeago';
import { createApp } from 'vue'

import de from 'date-fns/locale/de';

const app = createApp({})

app.use(install, {
    locale: 'de',
    locales: {
        de,
    },
});

License

Made with 💚

Published under MIT License.

Readme

Keywords

Package Sidebar

Install

npm i @vuecs/timeago

Weekly Downloads

250

Version

1.1.0

License

none

Unpacked Size

51.8 kB

Total Files

27

Last publish

Collaborators

  • tada5hi