ngx-dayjs
dayjs pipes for Angular
Installation
npm install --save ngx-dayjs
For System.js users:
First you need to install dayjs:
npm install dayjs --save
Don't forget to update your systemjs.config.js:
packages: {
app: {
main: './main.js',
defaultExtension: 'js'
},
'dayjs': {
main: './dayjs.js',
defaultExtension: 'js'
},
'ngx-dayjs': {
main: './index.js',
defaultExtension: 'js'
}
}
Usage
Import dayjsModule
into your app's modules:
;
This makes all the ngx-dayjs
pipes available for use in your app components.
Available pipes
amFromUnix pipe
Prints Last updated: 01:46PM
amParse pipe
Parses a custom-formatted date into a dayjs object that can be used with the other pipes.
Prints Last updated: January 24, 2016
amDifference pipe
Prints Expiration: 1 day
amAdd and amSubtract pipes
Use these pipes to perform date arithmetics. See dayjsjs docs for details.
Prints Expiration: 2017-03-17 18:55
Prints Last updated: 2012-03-17 16:55
Complete Example
;;;;platformBrowserDynamic.bootstrapModuleAppModule;