A lightweight TypeScript library for generating formatted document numbers such as bill numbers, invoice numbers, or custom identifiers. The current stable version is 1.0.33, and it is actively maintained with periodic updates. Key differentiators include support for date-based formatting (year, month, day), sequential value formatting with zero-padding, and fiscal year logic. It is designed for Node.js and browser environments and integrates easily with frameworks like Vue, React, and Angular. The library provides three main functions: formatDocumentNumber, fdnForDate, and formatDate. It is ESM and CJS compatible, ships TypeScript definitions, and has zero external dependencies.
npm install document-number-formatterNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to import and use the three main functions: formatDocumentNumber for generating numbers, fdnForDate for date-specific formatting, and formatDate for date-only formatting.
Replace [date:YYYY] with [YYYY] in your pattern strings.
Ensure the numeric value does not exceed the padding size (max 10). Use a larger format or split the value.
Use one of the recognized month abbreviations: jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec.
Use import { formatDocumentNumber } from 'document-number-formatter' instead of import formatDocumentNumber from 'document-number-formatter'.Ensure every '[' has a corresponding ']'. To include a literal ']', do not use a preceding '['.
Replace [date:YYYY] with [YYYY].
No dependency data recorded yet.