Skip to main content

Installation

Get started with Holy Time by installing it via your preferred package manager.

Package Managers

npm install holy-time
Holy Time has zero dependencies, so the installation is lightweight and fast.

Importing the Library

Once installed, you can import Holy Time in your project:
import HolyTime from 'holy-time'
import { HolyDuration } from 'holy-time'
import type { TimeResolvable, HumanUnit, IntervalUnit } from 'holy-time'

Available Exports

Holy Time exports the following:
  • HolyTime (default export) - The main class for date/time manipulation
  • HolyDuration - Class for working with time durations
  • TimeResolvable (type) - Accepts HolyTime, Date, number, or string
  • HumanUnit (type) - Time units: 'milliseconds', 'seconds', 'minutes', 'hours', 'days', 'weeks', 'months', 'years'
  • IntervalUnit (type) - Singular time units for intervals
  • TimeZone (type) - Valid timezone strings

TypeScript Configuration

1

Ensure TypeScript is configured

Holy Time is written in TypeScript and includes type definitions out of the box. Make sure your tsconfig.json is properly configured:
tsconfig.json
{
  "compilerOptions": {
    "target": "ES2015",
    "module": "commonjs",
    "moduleResolution": "node",
    "esModuleInterop": true,
    "strict": true,
    "skipLibCheck": true
  }
}
2

Enable strict mode (recommended)

For the best type safety experience, enable strict mode in your TypeScript configuration:
tsconfig.json
{
  "compilerOptions": {
    "strict": true
  }
}
Holy Time takes full advantage of TypeScript’s type system to provide excellent autocomplete and type checking.
3

Start using Holy Time

You’re all set! The type definitions are automatically available when you import the library:
import HolyTime from 'holy-time'

// Full type safety and autocomplete support
const tomorrow = HolyTime.in(1, 'days') // HolyTime
const isWeekend = tomorrow.isWeekend() // boolean

Module Formats

Holy Time supports both CommonJS and ES Modules:
  • ES Module: ./dist/index.mjs
  • CommonJS: ./dist/index.js
  • TypeScript Types: ./dist/index.d.ts
Your bundler or runtime will automatically select the appropriate format based on your environment.

Verification

Verify your installation by running a simple test:
test.ts
import HolyTime from 'holy-time'

const now = HolyTime.now()
console.log(now.format('YYYY-MM-DD HH:mm:ss'))
// Output: 2026-03-04 14:30:45 (current date/time)
If you encounter any issues during installation, make sure you’re using Node.js version 14 or higher.

Next Steps

Quickstart Guide

Learn how to use Holy Time with practical examples

Build docs developers (and LLMs) love