DEV Community


Discussion on: Don't Use The Date Object

igoradamenko profile image
Igor Adamenko

Huh. I partially agree on the topic, I guess. Partially, because I believe that it's alright to use semantic names for the functions. It's kinda “clean code” and Uncle Bob must be happy about this way.

But I mostly agree w/ this topic because Date object is broken. It's easy to understand the point when you see how many people use libraries such as Moment, Luxon, Date FNS, etc. Most of the time you're not satisfied of the built in functional of Date object.

Actually, in my team we've even built our own tiny wrapper for Date API:

GitHub logo funbox / chronos

One library to rule the time

Chronos avatar: white-on-black gloomy antique half-human half-clock face

Chronos is a tiny, immutable, typed date manipulation library which does not bloat your JS bundle,
but does everything you need


Chronos picture: gloomy antique half-human half-clock carved in stone face

  • Immutable & pure function per file. Every function does not have side effects, nor mutates the params If you use a function, only this function is added to your bundle, not the whole lib.
  • ESM & CommonJS. Works in Node.js and browser. Setup the target browsers for transpiling ES6 by your own in your bundler.
  • TypeScript. Every function is typed and the typings are bundled with the package.
  • Native API. Uses Date and Intl under the hood.
  • Russian locale only. And it has docs in Russian.


When we started to develop our projects, we picked the most popular date library that existed back then We had used only two methods it provided, but got all the bundled ones, with all the possible locales.

OK, we set…

josepheames profile image
Joe Eames Author

But is it testable?

igoradamenko profile image
Igor Adamenko

What do you mean? The repo has tests, if this what you're talking about.

Also there's no problem with E2E or Unit tests in our projects.

Thread Thread
josepheames profile image
Joe Eames Author

sorry, it sounded aggressive. Didn't mean it to be.

I meant exactly that. do unit tests work well?

And very cool job. Well done with putting that together.