🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
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
Version published
Weekly downloads
0
-100%
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

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

  • 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

angular

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