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

ngx-st-date-format

v18.0.2

Published

- [Overview](#overview) - [Installation](#installation) - [Pipes](#pipes) - [Usage Examples](#usage-examples)

Readme

Date Format Pipes - Complete Documentation

Table of Contents


Overview

The ngx-st-date-format library provides Angular pipes for formatting dates and times using the browser's locale.

Pipes included:

  • stDateFormatPipe: Formats dates
  • stDateTimeFormatPipe: Formats dates with time
  • stTimeFormatPipe: Formats time only

Installation

npm install ngx-st-date-format

Import the module:

import { StDateFormatModule } from 'ngx-st-date-format';

@NgModule({
  imports: [StDateFormatModule]
})
export class AppModule { }

Pipes

stDateFormatPipe

Formats a date using toLocaleDateString().

Input: string | Date | undefined | null
Output: Formatted date string or empty string

Example:

<p>{{ user.birthDate | stDateFormatPipe }}</p>
<!-- Output: 1/15/2024 (or locale-specific format) -->

<p>{{ '2024-01-15' | stDateFormatPipe }}</p>
<!-- Output: 1/15/2024 -->

stDateTimeFormatPipe

Formats a date with time using toLocaleString().

Input: string | Date | undefined | null
Output: Formatted date and time string or empty string

Example:

<p>{{ order.createdAt | stDateTimeFormatPipe }}</p>
<!-- Output: 1/15/2024, 2:30:45 PM (or locale-specific format) -->

<p>{{ '2024-01-15T14:30:45' | stDateTimeFormatPipe }}</p>
<!-- Output: 1/15/2024, 2:30:45 PM -->

stTimeFormatPipe

Formats time only using toLocaleTimeString().

Input: string | Date | undefined | null
Output: Formatted time string or empty string

Example:

<p>{{ meeting.startTime | stTimeFormatPipe }}</p>
<!-- Output: 2:30:45 PM (or locale-specific format) -->

<p>{{ '2024-01-15T14:30:45' | stTimeFormatPipe }}</p>
<!-- Output: 2:30:45 PM -->

Usage Examples

Example 1: User Profile

@Component({
  template: `
    <div class="profile">
      <p>Birth Date: {{ user.birthDate | stDateFormatPipe }}</p>
      <p>Registered: {{ user.registeredAt | stDateTimeFormatPipe }}</p>
      <p>Last Login: {{ user.lastLogin | stDateTimeFormatPipe }}</p>
    </div>
  `
})
export class ProfileComponent {
  user = {
    birthDate: new Date('1990-05-15'),
    registeredAt: new Date('2020-01-10T10:30:00'),
    lastLogin: new Date()
  };
}

Example 2: Order List

@Component({
  template: `
    <table>
      <tr *ngFor="let order of orders">
        <td>{{ order.id }}</td>
        <td>{{ order.orderDate | stDateFormatPipe }}</td>
        <td>{{ order.deliveryTime | stTimeFormatPipe }}</td>
        <td>{{ order.createdAt | stDateTimeFormatPipe }}</td>
      </tr>
    </table>
  `
})
export class OrderListComponent {
  orders = [
    {
      id: 1,
      orderDate: '2024-01-15',
      deliveryTime: '2024-01-15T14:30:00',
      createdAt: '2024-01-15T10:20:30'
    }
  ];
}

Example 3: Event Schedule

@Component({
  template: `
    <div *ngFor="let event of events">
      <h3>{{ event.name }}</h3>
      <p>Date: {{ event.date | stDateFormatPipe }}</p>
      <p>Time: {{ event.startTime | stTimeFormatPipe }} - {{ event.endTime | stTimeFormatPipe }}</p>
    </div>
  `
})
export class EventScheduleComponent {
  events = [
    {
      name: 'Team Meeting',
      date: '2024-01-20',
      startTime: '2024-01-20T09:00:00',
      endTime: '2024-01-20T10:30:00'
    }
  ];
}

Behavior

  • All pipes return empty string for null or undefined values
  • Dates are formatted using browser's locale settings
  • Accepts both Date objects and date strings
  • Uses native JavaScript date formatting methods

This library provides simple, locale-aware date formatting without additional configuration.