1.3.2 • Published 5 years ago

persian-time-ago-pipe v1.3.2

Weekly downloads
11
License
MIT
Repository
github
Last release
5 years ago

persian-time-ago-pipe

Build Status npm npm GitHub issues npm

A really simple, lightweight Angular pipe for converting a date string into a time ago

Time RangeOutput
0 - 45 secondsچند ثانیه پیش
45 - 90 secondsدقیقه ای پیش
90 seconds - 45 minutesX دقیقه پیش
45 - 90 minutesساعتی پیش
90 minutes - 22 hoursX ساعت پیش
22 - 36 hoursروزی پیش
36 hours - 25 daysX روز پیش
25 - 45 daysیک ماه پیش
45 - 345 daysX ماه پیش
345 - 545 days (1.5 years)یک سال پیش
546 days+X سال پیش

Installation

npm install persian-time-ago-pipe --save

Usage

It can be imported into your angular project, as you would for any other library.

In the @NgModule you want to use it in

import {PersianTimeAgoPipe} from 'persian-time-ago-pipe';

add "PersianTimeAgoPipe" to your declarations

@NgModule({
	imports: [... etc ...],
	declarations: [..., PersianTimeAgoPipe, ... ]
})

In your component templates you can just do:

<span>{{your_date | persianTimeAgo}}</span>

where "your_date" is a local date string, which could be parsed by the standard Js Date()

If this value is null or not parsable as a date, then the pipe will display nothing

1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.9

6 years ago

1.2.8

6 years ago

1.2.4

6 years ago

1.2.0

6 years ago

1.0.0

6 years ago