npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

angular-date-only

v0.1.5

Published

Angular module for managing JavaScript dates without the time part.

Readme

About

Angular module for managing JavaScript dates without the time part.

Working with dates in JavaScript can be a hassle, since Date objects also contain a time part. Due to time-zone differences between application and server, or from storing UTC dates in the database (as in MongoDB), the date-only representation can easily shift one day back or forth.

For server-side, there's two packages available by Bob Lauer: dateonly and mongoose-dateonly.

Angular-date-only is useful when you retrieve date-only objects from an api and want to preserve this date structure.

For trivial usage, checkout the library playground at the angular-date-only GitHub repository.

For an example of how the module can be utilized in a MEAN (MongoDB, Express, Angular, Node) setup, please checkout my hox-trader repository on GitHub.

Installation

To install this library, run:

$ npm install angular-date-only --save

Usage

Once installed, import DateOnlyModule into your AppModule:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';

// Import the module
import { DateOnlyModule } from 'angular-date-only';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,

    // Specify the module as an import
    DateOnlyModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

When the module is imported, you can use the class and pipe in your Angular application:

Class in models

import { DateOnly } from  'angular-date-only';

export class User {
  name: string;
  birthday: DateOnly;

  constructor(name: string, birthday: DateOnly) {
    this.name = name;
    this.birthday = birthday;
  }
}

Class in components

import { Component, OnInit } from '@angular/core';
import { DateOnly }  from 'angular-date-only';

@Component({
  selector: 'app',
  template: `<h3>date-only: {{ date }}</h3>`
})
class AppComponent implements OnInit {
  dateNumber: number = 20180420;
  date: DateOnly;

  constructor() { }

  ngOnInit(): void {
    this.date = new DateOnly(this.dateNumber);
  }
}

Pipe in view

The dateonly pipe extends the standard Angular date pipe. So any formatting argument can be applied in similar manner,

<h1>{{ user.birthday | dateonly }}</h1>
<h1>{{ user.birthday | dateonly: 'shortDate' }}</h1>
<h1>{{ user.birthday | dateonly: 'full' }}</h1>

Pipe in code

import { Component } from '@angular/core';
import { DateOnlyPipe } from 'angular-date-only';

@Component({
  selector: 'app',
  template: `<h3>date-only: {{ bithday }}</h3>`,
  providers: [DateOnlyPipe]
})
class AppComponent implements OnInit {
  bithday: string;

  constructor(private dateOnlyPipe: DateOnlyPipe)

  setBirthDay(birthday: number): void {
    this.birthday = this.dateOnlyPipe.transform(birthday;)
  }
}

Testing

To be implemented.

License

MIT © Lars Eriksson