time-ago-pipe
Advanced tools
Comparing version 0.0.3 to 1.0.0
{ | ||
"name": "time-ago-pipe", | ||
"version": "0.0.3", | ||
"version": "1.0.0", | ||
"description": "A simple Angular 2 pipe to change a date into a string of how long ago from it is from now", | ||
@@ -5,0 +5,0 @@ "main": "time-ago-pipe.js", |
# time-ago-pipe | ||
[![Build Status](https://travis-ci.org/AndrewPoyntz/time-ago-pipe.svg?branch=master)](https://travis-ci.org/AndrewPoyntz/time-ago-pipe) [![npm](https://img.shields.io/npm/v/time-ago-pipe.svg)]() [![npm](https://img.shields.io/npm/dt/time-ago-pipe.svg?maxAge=2592000)]() [![GitHub issues](https://img.shields.io/github/issues/AndrewPoyntz/time-ago-pipe.svg?maxAge=2592000?style=plastic)]() [![npm](https://img.shields.io/npm/l/time-ago-pipe.svg?maxAge=2592000?style=plastic)]() | ||
[![Build Status](https://travis-ci.org/AndrewPoyntz/time-ago-pipe.svg?branch=master)](https://travis-ci.org/AndrewPoyntz/time-ago-pipe) [![npm](https://img.shields.io/npm/v/time-ago-pipe.svg)](https://www.npmjs.com/package/time-ago-pipe) [![npm](https://img.shields.io/npm/dt/time-ago-pipe.svg?maxAge=2592000)](https://www.npmjs.com/package/time-ago-pipe) [![GitHub issues](https://img.shields.io/github/issues/AndrewPoyntz/time-ago-pipe.svg?maxAge=2592000?style=plastic)](https://github.com/AndrewPoyntz/time-ago-pipe/issues) [![npm](https://img.shields.io/npm/l/time-ago-pipe.svg?maxAge=2592000?style=plastic)](https://github.com/AndrewPoyntz/time-ago-pipe/blob/master/LICENSE) | ||
A really simple, lightweight Angular 2 pipe to convert a date/time into a string saying how long ago from now it was. | ||
A really simple, lightweight Angular 2 pipe for converting a date string into a time ago | ||
@@ -24,9 +24,2 @@ |Time Range|Output| | ||
## Usage | ||
In your component templates you can just do: | ||
``` | ||
<span>{{your_date | timeAgo}}</span> | ||
``` | ||
where "your_date" is something, which could be parsed by the standard Js Date() | ||
--- | ||
It can be imported into your angular project, as you would for any other library. | ||
@@ -63,2 +56,9 @@ | ||
``` | ||
--- | ||
In your component templates you can just do: | ||
``` | ||
<span>{{your_date | timeAgo}}</span> | ||
``` | ||
where "your_date" is a local date string, which could be parsed by the standard Js Date() | ||
@@ -52,3 +52,3 @@ "use strict"; | ||
else if (days <= 545) { | ||
return ' a year ago'; | ||
return 'a year ago'; | ||
} | ||
@@ -55,0 +55,0 @@ else if (days > 546) { |
@@ -35,3 +35,3 @@ import {Pipe, PipeTransform} from "@angular/core"; | ||
} else if (days <= 545) { | ||
return ' a year ago'; | ||
return 'a year ago'; | ||
} else if (days > 546) { | ||
@@ -38,0 +38,0 @@ return years + ' years ago'; |
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
10669
0