0.1.2 • Published 3 years ago

svelte-timeago v0.1.2

Weekly downloads
-
License
-
Repository
-
Last release
3 years ago

svelte-timeago

A simple Svelte component to provide relative time in the n{unit} ago format.

Demo - Svelte REPL

How to use

Install the package: npm i svelte-timeago

Import the package

<script>
	import TimeAgo from 'svelte-timeago';
</script>

<TimeAgo date="2021-10-25 11:13:00" live/>

Props

date

Default: null Date should be a valid Date object, a valid UNIX timestamp or a valid date string, preferably in ISO-8601 format.

live

Default: false Should the displayed time update every 1 second?

withSuffix

Default: true Should the word ago be displayed after the time?

asPrefix

Default: true Should the suffix be a prefix instead? i.e. Il y à n{unit}

suffix

Default: ago The suffix used when withSuffix is set to true.

units

Default:

{
	seconds:'s',
	minutes:'m',
	hours:'h',
	days:'d',
	months:'mo',
	years:'y'
}

The units to be displayed. Can also be used to set your own locale. i.e. 時間 etc.

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago