RepositoryTypeScriptGBUnited Kingdom
AndrewPoyntz

AndrewPoyntz/time-ago-pipe

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

127stars
66forks
18issues
1views

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 secondsa few seconds ago
45 - 90 secondsa minute ago
90 seconds - 45 minutesX minutes ago
45 - 90 minutesan hour ago
90 minutes - 22 hoursX hours ago
22 - 36 hoursa day ago
36 hours - 25 daysX days ago
25 - 45 daysa month ago
45 - 345 daysX months ago
345 - 545 days (1.5 years)a year ago
546 days+X years ago

Installation

npm install 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 {TimeAgoPipe} from 'time-ago-pipe';

add "TimeAgoPipe" to your declarations

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

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()

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

Similar Projects

Discover other similar projects and AI models.

RepositoryTypeScript
zhongsp/TypeScript

TypeScript 使用手册(中文版)翻译。http://www.typescriptlang.org

7.4k
Jul 5, 2026
RepositoryTypeScript
ihym/ngx-timeago

⏰ Live updating timestamps in Angular

80
Feb 5, 2026
RepositoryHTML
PatrickJS/awesome-angular

:page_facing_up: A curated list of awesome Angular resources

10.1k
Dec 1, 2026
RepositoryTypeScript
morluto/rea

Reverse engineer anything with agents, from app behavior down to native binaries.

487.0k
Dec 2, 2026
RepositoryTypeScript
freeCodeCamp/freeCodeCamp

freeCodeCamp.org's open-source codebase and curriculum. Learn math, programming, and computer science for free.

459.9k
Dec 2, 2026
RepositoryTypeScript
nilbuild/developer-roadmap

Interactive roadmaps, guides and other educational content to help developers grow in their careers.

373.1k
Dec 1, 2026
RepositoryTypeScript
firecrawl/firecrawl

Firecrawl is the knowledge infrastructure to make your agents smarter. It connects your agents to the web, and to Alexandria, our library of everything else.

215.1k
Dec 2, 2026
RepositoryTypeScript
vuejs/vue

This is the repo for Vue 2. For Vue 3, go to https://github.com/vuejs/core

212.6k
Oct 10, 2024
RepositoryPython
donnemartin/system-design-primer

Learn how to design large-scale systems. Prep for the system design interview. Includes Anki flashcards.

379.9k
Sep 15, 2026