# v-simple-timeago

> A simple and no-dependencies timeago component to convert complex dates into human readable date strings.

Latest version **0.0.2** (published 2022-01-07) · 0 weekly downloads

## Install

```sh
npm install v-simple-timeago
pnpm add v-simple-timeago
yarn add v-simple-timeago
bun add v-simple-timeago
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2022-01-07 |
| First published | 2021-08-17 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=12 |
| Dependencies | 0 |
| Unpacked size | 22.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jonathan Arias |
| Maintainers | jonalxh |
| Keywords | timeago, vue-timeago, timestamp to date, timestamp to string, relative date, date, date convert, readable date, fecha, fecha relativa, fecha vue, timestamp a fecha, timestamp a texto |

## Links

- npm: https://www.npmjs.com/package/v-simple-timeago
- Repository: https://github.com/jonalxh/v-simple-timeago
- Issues: https://github.com/jonalxh/v-simple-timeago/issues
- npm.io page: https://npm.io/package/v-simple-timeago

## Alternatives

- [@js-joda/timezone](https://npm.io/package/@js-joda/timezone.md) — 383.4K weekly downloads
- [chartjs-adapter-moment](https://npm.io/package/chartjs-adapter-moment.md) — 210.8K weekly downloads
- [strftime](https://npm.io/package/strftime.md) — 171.2K weekly downloads
- [vue-flatpickr-component](https://npm.io/package/vue-flatpickr-component.md) — 115.8K weekly downloads
- [timepicker](https://npm.io/package/timepicker.md) — 51.0K weekly downloads

## Recent versions

- 0.0.2 (latest) — 2022-01-07
- 0.0.1 — 2022-01-07
- 0.1.2 — 2021-08-17
- 0.1.1 — 2021-08-17
- 0.1.0 — 2021-08-17

## README

# v-simple-timeago

A simple Time Ago component for Vue to convert timestamp dates into human readable date strings (relative dates).

This Web Component works based on Javascript Intl.RelativeTimeFormat, so it will translate dates into the locale language of the browser, in next versions it will allow to define an specific locale code. Using Intl.RelativeTimeFormat allows us to reduce the dependencies and be focused on new Browser technologies, see [browser compatibility](https://developer.mozilla.org/es/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat).

## Setup
Add the component to your node-modules or libraries folder (soon)
```
npm i v-simple-timeago
```

Import the component into your .vue files and add it to the components section
```
import VSimpleTimeago from "v-simple-timeago"

export default {
    components: {
        VSimpleTimeago
    },
    data() {
        return {
            now: Date.now(),
            yesterday: 1628646076306
        }
    }
}
```


Use it in your template.
```
<VSimpleTimeago :date="now"></VSimpleTimeago> <!-- 0 seconds ago -->

<VSimpleTimeago :date="yesterday"></VSimpleTimeago> <!-- 1 day ago -->
```

## Props 

| Prop   |      Default      |  Definition |
|----------|:-------------:|------:|
| date      |  Date.now() | Required to display a correct date formatted |
| initialUpper |    true   |   Sets the initial letter to upper case |
| lang | undefined | Sets the language of the output relative date, if undefined it will generate with the browser language |




## Development
```
npm install
```

### Compiles and hot-reloads for development
```
npm run serve
```

### Compiles and minifies for production
```
npm run build
```

### Lints and fixes files
```
npm run lint
```

---
_Source: https://npm.io/package/v-simple-timeago · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
