ngx-round-date
TypeScript icon, indicating that this package has built-in type declarations

0.0.9 • Public • Published

ngx-round-date

npm version npm downloads

Simple round-date pipe

  • Compatible with Angular version 12.2.0

Example

Code:

this.testDate=new Date(2022,12,31,23,59,59);

Template:

<span>{{testDate | roundDate}}</span> 

It displays:

01/02/2023 00:00:00

Usage

  1. Install ngx-round-date through npm package manager using the following command:

    npm i ngx-round-date --save
  2. Add RoundDatePipeModule into your AppModule class. app.module.ts would look like this:

    import {NgModule} from '@angular/core';
    import {BrowserModule} from '@angular/platform-browser';
    import {AppComponent} from './app.component';
    import { RoundDatePipeModule } from 'ngx-round-date';
    
    @NgModule({
      imports: [BrowserModule, RoundDatePipeModule],
      declarations: [AppComponent],
      bootstrap: [AppComponent],
    })
    export class AppModule {
    }
  3. Add the pipe into html (default round 5 minutes)

    <span>{{testDate | roundDate}}</span>

    or

    <span>{{testDate | roundDate:10}}</span>

License

The MIT License (see the LICENSE file for the full text)

Readme

Keywords

none

Package Sidebar

Install

npm i ngx-round-date

Weekly Downloads

0

Version

0.0.9

License

MIT

Unpacked Size

19.8 kB

Total Files

14

Last publish

Collaborators

  • danyolgiax