Date/time related API, based on Day.js

Usage no npm install needed!

<script type="module">
  import naturalcyclesTimeLib from 'https://cdn.skypack.dev/@naturalcycles/time-lib';



Date/time API, based on Dayjs.

npm min.gz size code style: prettier


  • Fixes TypeScript imports, regardless if esModuleInterop is used or not
  • Allows to use it as ESM package with tree-shaking (without breaking your TypeScript again)
  • Opinionated. Includes "needed" dayjs plugins by default.
  • Allows to "just import dayjs" and not worry about:
    • Loading plugins for all of your "entry points", such as startServer.ts, setupJest.ts, at every cron job, etc.
    • That plugins are loaded BEFORE they are used (dependent on import order)
    • That TypeScript types are not loaded with plugins
  • Extends dayjs with some useful functions (via Plugin interface)
  • Has working isoWeekday plugin
  • Has en-gb locale by default, so, default firstDayOfWeek is Monday