date-fns VS jsdom

Compare date-fns vs jsdom and see what are their differences.

date-fns

⏳ Modern JavaScript date utility library ⌛️ (by date-fns)

jsdom

A JavaScript implementation of various web standards, for use with Node.js (by jsdom)
Our great sponsors
  • Scout APM - A developer's best friend. Try free for 14-days
  • Nanos - Run Linux Software Faster and Safer than Linux with Unikernels
  • SaaSHub - Software Alternatives and Reviews
date-fns jsdom
42 21
26,939 16,624
0.0% 0.7%
9.1 8.2
2 months ago 5 days ago
JavaScript JavaScript
MIT License MIT License
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

date-fns

Posts with mentions or reviews of date-fns. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2021-10-31.

jsdom

Posts with mentions or reviews of jsdom. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2021-10-24.
  • Emulating dom server side?
    1 project | reddit.com/r/vuejs | 3 Dec 2021
    I think jsdom is what you want to look into. https://github.com/jsdom/jsdom
  • Testing Solid.js code beyond jest
    7 projects | dev.to | 24 Oct 2021
    jsdom, full-featured, but slow, the default option in jest
  • Developing and Testing Web Components
    4 projects | dev.to | 13 Oct 2021
    The next consideration I addressed was being able to easily write and run unit tests for vue-uhtml components. Having previously talked about a unit testing approach for Vue.js components, I was keen to apply the principle of “writing tests that assert your component’s public interface”. Before I could even think about writing component tests, I had to pick the most appropriate and well supported tooling. Vue’s documentation on testing and own vue-test-utils package makes this choice a foregone conclusion with Jest as a comprehensive test framework, and using vue-test-util’s wrapper based API to mount components in an isolated jsdom environment. While jsdom has provided a Custom Elements implementation since version 16, other Web Components APIs including Shadow DOM are not supported or reliable enough to be useful.
  • Making a Toggle Switch into a New HTML Element
    1 project | dev.to | 24 Sep 2021
    I'm highlighting the "against a real browser" bit because doing so provides the highest confidence that the element as it behaves in tests will be the same as it behaves in the wild. This is opposed to using something like jsdom, which has classically had poor support for web components.
  • What's the simplest way to do this?
    1 project | reddit.com/r/CodingHelp | 14 Sep 2021
    Assuming there's no API for this, you'd need to do this with a scraper. Something like JSDom would seem to work for you as you should be able to execute whatever scripts necessary (though I've never used it myself.)
  • Test Driven Development with Svelte - Querying Elements
    1 project | dev.to | 31 Aug 2021
    We are using two functions of testing-library. First we are rendering the component. The test runner, Jest is using jsdom. And it is providing us a browser-like environment. And the testing library is rendering the component into that document. And then we run queries coming with screen to get the elements we are looking for in that document. To get a better view about all available query functions, you can check the testing-library documentation from docs
  • Yes.
    1 project | reddit.com/r/programminghorror | 30 Aug 2021
    Well there's xmldom and jsdom but they're super heavy and seem like a really backwards solution for server side rendering.
  • What's the best JavaScript web scraper ?
    1 project | reddit.com/r/learnjavascript | 30 Aug 2021
    I recently used https://github.com/jsdom/jsdom
  • Creating a Medium API for Next.js from an RSS feed
    4 projects | dev.to | 24 Jul 2021
    jsdom: a pure JavaScript implementation of web standard to emulate a subset of a web browser. We're going to use it for DOM manipulation, handy since some of the RSS response is in HTML.
  • An agnostic, reactive & minimalist (3kb) UI library with direct access to native DOM
    2 projects | dev.to | 16 Jul 2021
    You can use a library like JS-DOM to implement a browser context on the server.

What are some alternatives?

When comparing date-fns and jsdom you can also consider the following projects:

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

cheerio - Fast, flexible, and lean implementation of core jQuery designed specifically for the server.

Luxon - ⏱ A library for working with dates and times in JS

countdown.js - Super simple countdowns.

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

moment-timezone - Timezone support for moment.js

Electron - :electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS

webworker-threads - Lightweight Web Worker API implementation with native threads

fecha - Lightweight and simple JS date formatting and parsing

Prettyprint Object - Function to pretty-print an object with an ability to annotate every value.

tz-format - Format a date with timezone

jquery-timeago - :clock8: The original jQuery plugin that makes it easy to support automatically updating fuzzy timestamps (e.g. "4 minutes ago").