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

@idris-maps/yyyy-mm-dd

v0.0.2

Published

A date library dealing only with days in the YYYY-MM-DD format

Readme

yyyy-mm-dd

A date library dealing only with days in the YYYY-MM-DD format.

  • No dependencies.
  • All functions with multiple arguments are curried.
  • Types are included.

Usage

Install

npm install @idris-maps/yyyy-mm-dd

Example usage

import { add } from '@idris-maps/yyyy-mm-dd'

add('days', 3, '2021-01-01') // 2021-01-04

// or

const addThreeDays = add('days', 3)
addThreeDays('2021-01-01') // 2021-01-04

// or

const addDays = add('days')
const add3Days = addDays(3)
add3Days('2021-01-01') // 2021-01-04

Functions

add(unit: Unit, n: number, day: string) => string

where Unit is:

type Unit = 'day'
  | 'days'
  | 'week'
  | 'weeks'
  | 'month'
  | 'months'
  | 'year'
  | 'years'

and n is an integer.

addDays(day, number) => day

A shorthand for add('day') or add('days')

addMonths(day, number) => day

A shorthand for add('month') or add('months')

addWeeks(day, number) => day

A shorthand for add('week') or add('weeks')

addYears(day, number) => day

A shorthand for add('year') or add('years')

daysInMonth(day) => day[]

Takes a day and returns an array of all the days in that month.

daysInMonth('2021-01-01') // ['2021-01-01', '2021-01-02', ..., '2021-01-31']

details(day) => DayDetails

Takes a day and returns DayDetails as:

interface DayDetails {
  day: string
  index: {
    week: number
    weekInMonth: number
    weekday: number
    month: number
  },
  iso: {
    week: number
    weekday: number
  }
  string: {
    DD: string
    MM: string
    YYYY: string
    YY: string
  }
  number: {
    day: number
    month: number
    year: number
  }
}

firstDayOfMonth(day) => day

Takes a day and returns the first day of that month.

fromJsDate(Date) => day

Takes a javascript Date and returns a day (YYYY-MM-DD string).

isoWeek(day) => number

Takes a day and returns the ISO-8601 week.

isoWeekday(day) => number

Takes a day and returns the ISO-8601 weekday.

lastDayOfMonth(day) => day

Takes a day and returns the last day of that month.

monthsInRange(Range) => month[]

Get all month within a range. See range() for how to get a range.

interface Range {
  start: string // yyyy-mm-dd
  end: string // yyyy-mm-dd
}

month is a string in the yyyy-mm format.

range(day[]) => Range

Takes an array of days and returns a Range

interface Range {
  start: string // yyyy-mm-dd
  end: string // yyyy-mm-dd
}

subtract(unit: Unit, n: number, day: string) => string

where Unit is:

type Unit = 'day'
  | 'days'
  | 'week'
  | 'weeks'
  | 'month'
  | 'months'
  | 'year'
  | 'years'

and n is an integer.

subtractDays(day, number) => day

A shorthand for subtract('day') or subtract('days')

subtractMonths(day, number) => day

A shorthand for subtract('month') or subtract('months')

subtractWeeks(day, number) => day

A shorthand for subtract('week') or subtract('weeks')

subtractYears(day, number) => day

A shorthand for subtract('year') or subtract('years')

today() => day

Returns today as a yyyy-mm-dd string.

validate(any) => DayValidation

Checks if a value is a day. Returns DayValidation

interface DayValidation {
  valid: boolean
  error?: string
}

weekdayIndex(day) => number

Takes a day and returns the index of the weekday. 0 is Monday.