Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. JavaScript
  3. fecha

fecha

MITJavaScript4.2.1

A lightweight JavaScript library for date formatting and parsing, designed as a minimal alternative to moment.js.

GitHubGitHub
2.1k stars123 forks0 contributors

What is fecha?

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.

Target Audience

JavaScript developers who need efficient date formatting and parsing in web or Node.js applications, particularly those concerned about bundle size and performance.

Value Proposition

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.

Overview

Lightweight and simple JS date formatting and parsing

Use Cases

Best For

  • Formatting dates for display in web applications with custom formats
  • Parsing user-input date strings in forms or data imports
  • Reducing bundle size in performance-critical frontend projects
  • Adding internationalization support for date displays
  • Replacing moment.js in projects that only need formatting/parsing
  • Creating consistent date formats across an application with custom masks

Not Ideal For

  • Applications requiring date arithmetic like adding days or calculating intervals
  • Projects that need to parse arbitrary date strings without prior format knowledge
  • Teams looking for out-of-the-box internationalization with pre-configured locales for many languages
  • Systems where robust, silent error handling for invalid dates is preferred over throwing errors

Pros & Cons

Pros

Tiny Bundle Size

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.

Comprehensive Format Tokens

Supports a wide range of tokens for custom formatting, including months, days, years, and fractional seconds, detailed in the formatting tokens table.

Flexible i18n Customization

Allows full customization of day/month names, AM/PM labels, and ordinal suffixes via setGlobalDateI18n, enabling easy localization without bloat.

Custom Named Masks

Enables defining reusable format patterns with setGlobalDateMasks, promoting consistency across applications, as shown in the examples for masks like 'myMask'.

Cons

No Date Manipulation

Fecha explicitly excludes date arithmetic features like adding days or comparisons, requiring separate libraries for such operations, as admitted in the vs. Moment table.

Parsing Requires Explicit Format

The parse function must be given a format string; it cannot automatically detect date formats, limiting flexibility with unpredictable user input.

Basic Error Handling

Both format and parse throw errors on invalid parameters, which can crash applications if not caught, unlike libraries that return null or defaults.

Manual i18n Setup

Internationalization requires manual configuration of all locale strings; there are no pre-built locale files, increasing setup time for multi-language apps.

Open Source Alternative To

fecha is an open-source alternative to the following products:

m
moment.js

Frequently Asked Questions

Quick Stats

Stars2,072
Forks123
Contributors0
Open Issues3
Last commit3 years ago
CreatedSince 2015

Tags

#parsing#lightweight#frontend#nodejs#javascript-library#i18n#date#javascript#date-parsing#utility#date-formatting

Built With

J
JavaScript

Included in

JavaScript34.9kMicro npm Packages4.6k
Auto-fetched 1 day ago

Related Projects

Day.jsDay.js

⏰ Day.js 2kB immutable date-time library alternative to Moment.js with the same modern API

Stars48,627
Forks2,427
Last commit7 days ago
Moment.jsMoment.js

Parse, validate, manipulate, and display dates in javascript.

Stars47,987
Forks7,007
Last commit1 year ago
date-fnsdate-fns

⏳ Modern JavaScript date utility library ⌛️

Stars36,562
Forks1,943
Last commit7 months ago
LuxonLuxon

⏱ A library for working with dates and times in JS

Stars16,382
Forks770
Last commit2 days ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub