

Light (1kb gzipped) Javascript date and time utilities (formatting, ranges e.t.c).

If you appreciate this project, please 🌟 it on GitHub.

Dubium works both in the browser and with node.

For browser use, either host the dubium.js file yourself (By downloading the current release here) or use a CDN (and, yes, it's free):

< script src = " https://cdn.jsdelivr.net/npm/dubium@0.0.14/dist/dubium.min.js " > < / script >

As for NodeJS, it can be included like so:

const dubium = require ( " dubium " ) ;

Example

dubium . format ( " DD/MM/YYYY hh:mm:ss " ) dubium . format ( " MM/DD/YYYY H:mm:ss a " ) dubium . format ( " DD/MMM/YY H:mm:ss A " ) dubium . format ( " DD/MMMM/YY H:mm:ss A " ) dubium . format ( " DD/MM/YYYY hh:mm:ss " , 1554159037369 ) ; dubium . format ( " DD/MM/YYYY hh:mm:ss " , " Fri, 02 Feb 1996 03:04:05 GMT " ) ; dubium . unformat ( " 01/March/70 7:30:00 PM " , " DD/MMMM/YY H:mm:ss A " ) ; dubium . daysInRange ( 1554160761053 , 1554333561053 ) dubium . getWeekRange ( ) dubium . getWeekRange ( 3163604400000 ) ;

Benchmarks

Tested the speed of formatting and unformatting in Chrome 75 on Windows 10.

See it for yourself here on jsPerf.

Library Ops/sec Dubium 197,278 DayJS 108,859 MomentJS 56,163

Development

Building dubium for browser: