Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

angular-timeago

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-timeago

Angular directive/filter/service for formatting date so that it displays how long ago the given time was compared to now.

  • 0.1.11
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.9K
increased by22.03%
Maintainers
1
Weekly downloads
 
Created
Source

angular-timeago Analytics

Angular directive/filter/service for formatting date so that it displays how long ago the given time was compared to now.

Disclaimer

This project is based off of a thread on Angular Google Groups. The person who started the thread, @lrlopez, gave me permission to start a repo using the code he wrote initially. Thanks to @lrlopez and other contributors in the thread.

Demo

Check out the demo here.

Usage

Install via Bower

bower install --save angular-timeago

Reference in module

var app = angular.module('ngApp', [
  'yaru22.angular-timeago'
]);

Filter

{{myDate | timeAgo}}

Displays time ago since myDate. myDate can be time in milliseconds since January 1st 1970 (see MDN Date.prototype.getTime) or an ISO 8601 string (see MDN Date.prototype.toISOString)

Language support angular-timeago currently supports: en_US, de_DE, he_IL, pt_BR. If you want more languages: feel free to contribute! The language is determined by the string in document.documentElement.lang which you can set in your HTML markup:

<html lang="en_US"></html>

Or directly in JS:

window.document.documentElement.lang = 'en_US';

You can also add additional or alter existing languages at runtime by extending the service:

timeAgo.settings.strings.en_US = {
  // appropriate keys here
};

For more details refer to the source code.

Testing

In order to run the e2e tests you might need to install a Selenium server via:

./node_modules/grunt-protractor-runner/scripts/webdriver-manager-update```

And then use grunt to run all tests (unit and e2e):

grunt test

Keywords

FAQs

Package last updated on 22 May 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc