GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - keyone2693/persian-time-ago-pipe: An Angular pipe for converting a date string into persian a time ago

BranchesTags
Open more actions menu

Latest commit

 

History

21 Commits
21 Commits

Folders and files

NameName
Last commit message
Last commit date
e2e
e2e
 
 
src
src
 
 
.browserslistrc
.browserslistrc
 
 
.editorconfig
.editorconfig
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
angular.json
angular.json
 
 
karma.conf.js
karma.conf.js
 
 
ng-package.json
ng-package.json
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
public_api.ts
public_api.ts
 
 
tsconfig.app.json
tsconfig.app.json
 
 
tsconfig.json
tsconfig.json
 
 
tsconfig.spec.json
tsconfig.spec.json
 
 
tslint.json
tslint.json
 
 

Repository files navigation

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

version

angular 9+

Time Range Output
0 - 45 seconds چند ثانیه پیش
45 - 90 seconds دقیقه ای پیش
90 seconds - 45 minutes X دقیقه پیش
45 - 90 minutes ساعتی پیش
90 minutes - 22 hours X ساعت پیش
22 - 36 hours روزی پیش
36 hours - 25 days X روز پیش
25 - 45 days یک ماه پیش
45 - 345 days X ماه پیش
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 { PersianTimeAgoModule } from 'persian-time-ago-pipe';

add "PersianTimeAgoPipe" to your declarations

@NgModule({
	imports: [... ,PersianTimeAgoModule , ...]
})

In your component templates you can just do:

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

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

//in component
_dt = new Date();
//in html
<span>{{_dt.toString() | persianTimeAgo}}</span>

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

About

An Angular pipe for converting a date string into persian a time ago

Resources

Readme
MIT license
Activity

Stars

10 stars

Watchers

2 watching

Forks

2 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.