A lightweight JavaScript library for date formatting and parsing, designed as a minimal alternative to moment.js.
Fecha is a lightweight JavaScript library that provides date formatting and parsing functionality. It allows developers to convert Date objects to formatted strings and parse date strings into Date objects using customizable tokens and masks. It solves the problem of needing simple date manipulation without the large bundle size of comprehensive date libraries.
JavaScript developers who need efficient date formatting and parsing in web or Node.js applications, particularly those concerned about bundle size and performance.
Developers choose Fecha for its minimal footprint (~2KB), focused feature set, and straightforward API. It offers a direct replacement for moment.js's formatting and parsing capabilities while being significantly smaller and faster.
Lightweight and simple JS date formatting and parsing
At ~2KB minified and gzipped, Fecha adds minimal overhead, making it ideal for performance-critical web apps, as highlighted in the README's comparison with Moment.js.
Supports a wide range of tokens for custom formatting, including months, days, years, and fractional seconds, detailed in the formatting tokens table.
Allows full customization of day/month names, AM/PM labels, and ordinal suffixes via setGlobalDateI18n, enabling easy localization without bloat.
Enables defining reusable format patterns with setGlobalDateMasks, promoting consistency across applications, as shown in the examples for masks like 'myMask'.
Fecha explicitly excludes date arithmetic features like adding days or comparisons, requiring separate libraries for such operations, as admitted in the vs. Moment table.
The parse function must be given a format string; it cannot automatically detect date formats, limiting flexibility with unpredictable user input.
Both format and parse throw errors on invalid parameters, which can crash applications if not caught, unlike libraries that return null or defaults.
Internationalization requires manual configuration of all locale strings; there are no pre-built locale files, increasing setup time for multi-language apps.
⏰ Day.js 2kB immutable date-time library alternative to Moment.js with the same modern API
Parse, validate, manipulate, and display dates in javascript.
⏳ Modern JavaScript date utility library ⌛️
⏱ A library for working with dates and times in JS
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.