1.2.2 • Published 6 years ago
svelte-date-component v1.2.2
svelte-date-component
A svelte component for displaying the amount of elapsed time since a given date.
Usage
Add it to your svelte project:
$ npm i svelte-date-component --saveThen, pop it into the component that suites you:
<script>
import Elapsed from 'svelte-date-component';
let date = new Date().getTime();
</script>
<Elapsed mils={date}/>As you can see svelte-date-component has only one prop: mils of type number.
The above example would display this:
Just now... until 3 seconds has elapsed, then it would display:
4 seconds agoThis example...
<script>
import Elapsed from 'svelte-date-component';
let date = new Date().getTime() - 1000 * 60 * 60 * 24; // One day before now
</script>
<Elapsed mils={date}/>...displays this:
About a day agoBugs
Found an problem? Submit an issue, or ping me on Discord: Vehmloewff#0724.