0.0.9 • Published 4 years ago

ng-timeago v0.0.9

Weekly downloads
14
License
-
Repository
github
Last release
4 years ago

NgTimeago

Angular 9 Date, DateTime, and timeago

Currently only support Chinese language.

npm version licence Build Status

Usage

demo

Install

npm i ng-timeago

Import

import { NgTimeagoModule } from 'ng-timeago';
@NgModule({
      imports: [..., NgTimeagoModule]
      ...})

use

      .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

Development server

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.

Code scaffolding

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.

Build

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.

Running unit tests

Run ng test to execute the unit tests via Karma.

Running end-to-end tests

Run ng e2e to execute the end-to-end tests via Protractor.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI README.

Create Angular library with Angular CLI

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/"