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

angular-moment-filter

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-moment-filter

moment filter for angular.js

  • 0.1.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

moment-filter

The filter for angular.js based on moment.js(http://momentjs.com). Forked from dotSlashLu/moment-filter and published to npm.

Installation

  1. Get the dependencies: bower install angular-moment-filter --save or just include index.js anyhow.

  2. Inject moment-filter to your app angular.module('yourModule', ['moment-filter']);

Usage

{{input | moment:"function":"param1":"param2":...}} is equivalent to moment(input).function(param1, param2, ...)

  • input: data valid for moment(), string(e.g. "2014-11-01"), object(e.g new Date), etc. If you need to pass multiple strings as parameter for moment(), use array(e.g. [param1, param2] for moment(param1, param2))

  • function: function in moment().__proto__, e.g. format, fromNow, subtract, etc. (Note, you should pass a function name as a string, use {{str | moment : "fromNow"}} rather than {{str | moment : fromNow}})

  • params: params passed to function, each separated by :

To chain methods, just use another pipe: {{str | moment:"subtract":1:'ms' | moment:"quarter"}} -> moment(str).subtract(1, 'ms').quarter()

Examples

screenshot

See test.html or this Plunker: http://plnkr.co/edit/JXOYvZY7UeRbPxNbPe8i.

References

Keywords

FAQs

Package last updated on 25 Oct 2016

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