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

canducci-datewise

v1.0.1

Published

Date and time validation and manipulation routines.

Readme

Datewise - DateTime Validation && Formatted

Overview

Datewise is a TypeScript library for date and time validation, formatting, and comparison using Luxon.

Installation

Assuming npm: npm install datewise

Usage

Import the main class:

import { Datewise } from 'datewise';

API Documentation

Datewise

The main class that provides access to validation and formatting utilities.

Methods

  • validation(): Validation - Returns a Validation instance.
  • formatted(): Formatted - Returns a Formatted instance.
  • static createValidation(options?: IOptions): Validation - Creates a new Validation instance.
  • static createFormatted(options?: IOptions): Formatted - Creates a new Formatted instance.

Example

const datewise = new Datewise();
const validator = datewise.validation();
const formatter = datewise.formatted();

Validation

Handles date, time, and datetime validation and comparisons.

Methods

  • isValidDate(value: string, format = "yyyy-MM-dd"): boolean - Checks if a string is a valid date.
  • isValidTime(value: string, format = "HH:mm"): boolean - Checks if a string is a valid time.
  • isValidDateTime(value: string, format = "yyyy-MM-dd HH:mm:ss"): boolean - Checks if a string is a valid datetime.
  • isBefore(date1: string, date2: string, format = "yyyy-MM-dd"): boolean - Checks if date1 is before date2.
  • isAfter(date1: string, date2: string, format = "yyyy-MM-dd"): boolean - Checks if date1 is after date2.

Examples

const validation = new Validation();

console.log(validation.isValidDate("2023-12-25")); // true
console.log(validation.isValidTime("14:30")); // true
console.log(validation.isBefore("2023-01-01", "2023-12-31")); // true

Formatted

Formats dates, times, and datetimes.

Methods

  • formatDate(value: string, format = "yyyy-MM-dd"): string | null - Formats a date string.
  • formatTime(value: string, format = "HH:mm:ss"): string | null - Formats a time string.
  • formatDateTime(value: string, format = "yyyy-MM-dd HH:mm:ss"): string | null - Formats a datetime string.

Examples

const formatted = new Formatted();

console.log(formatted.formatDate("2023-12-25")); // "12/25/2023" (depending on locale)
console.log(formatted.formatTime("14:30:00")); // "2:30 PM"

DateFormatBuilder

A builder for creating custom date format strings.

Methods

  • day(): DateFormatBuilder - Adds day to the format.
  • month(): DateFormatBuilder - Adds month.
  • year(): DateFormatBuilder - Adds year.
  • hours(): DateFormatBuilder - Adds hours.
  • minutes(): DateFormatBuilder - Adds minutes.
  • seconds(): DateFormatBuilder - Adds seconds.
  • dash(): DateFormatBuilder - Adds dash separator.
  • slash(): DateFormatBuilder - Adds slash separator.
  • space(): DateFormatBuilder - Adds space separator.
  • colon(): DateFormatBuilder - Adds colon separator.
  • build(): string - Builds and returns the format string.

Example

const format = new DateFormatBuilder()
  .day()
  .slash()
  .month()
  .slash()
  .year()
  .space()
  .hours()
  .colon()
  .minutes()
  .build(); // "dd/MM/yyyy HH:mm"