Angular 9 Date, DateTime, and timeago
Currently only support Chinese language.
npm i @joyingsoft/ng-timeago
import { NgTimeagoModule } from 'ng-timeago';
@NgModule({
imports: [..., NgTimeagoModule]
...})
.color-b {color:green;}
...
<ng-timeago [date]="dt"
[styles]="'color-b'"></ng-timeago>
<ng-timeago [date]="dt"
[show]="'date'"></ng-timeago>
<ng-timeago [date]="dt"
[show]="'dateTime'"></ng-timeago>
<ng-timeago [date]="dt"
[show]="'timeago'"></ng-timeago>
This project was generated with Angular CLI
Run ng serve
for a dev server. Navigate to http://localhost:4200/
. The app will automatically reload if you change any of the source files.
Run ng generate component component-name
to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module
.
Run ng build
to build the project. The build artifacts will be stored in the dist/
directory. Use the --prod
flag for a production build.
Run ng test
to execute the unit tests via Karma.
Run ng e2e
to execute the end-to-end tests via Protractor.
To get more help on the Angular CLI use ng help
or go check out the Angular CLI README.
create an empty workspace ng new ng-timeago --create-application=false
--createApplication=true|false When true (the default), creates a new initial app project in the src folder of the new workspace. When false, creates an empty workspace with no initial app. You can then use the generate application command so that all apps are created in the projects folder. Default: true doc
Add library project ng generate library ng-timeago -p=ng
Add demo ng generate application ng-timeago-demo
Build library ng build ng-timeago
Run demo: ng serve ng-timeago-demo
Build Demo: ng build ng-timeago-demo --prod --base-href "/ng-timeago/"