Dates
Dates

Overview

A tiny date formatting library with built-in i18n support.

npm versionnpm downloadsBundlephobia

Installation

# npm
npm i --save @weser/dates

# yarn
yarn add @weser/dates

# pnpm
pnpm add @weser/dates

Motivation

There are several date formatting libraries out there. It all started with Moment (new tab), while nowadays smaller alternatives such as date-fns (new tab), DayJS (new tab) and Luxon (new tab) among others are raising in popularity.
While date-fns (new tab) already comes in a really small format, it was still way to big for my most common use case: Format a date with a given pattern.
So I created this tiny library as an attempt to solve this specific problem with as little bytes as possible.

How It works

I was using Intl.DateTimeFormat (new tab) previously and really liked it. So I had the idea to use that under the hood while providing a nice API that accepts a pattern in a widely used format.
The nice thing about Intl.DateTimeFormat (new tab) is that it has built-in i18n support.

On this page