Skip to content

API Reference

The useTemporal API is organized into the following sections:

Factory Functions

Core functions for creating temporal instances.

Operations

Functions for manipulating and working with periods.

Time Division

  • divide - The signature divide() pattern
  • split - Advanced splitting with options
  • merge - Merge periods into larger units
  • period - Create periods (standard or custom)
  • next - Navigate to next period
  • previous - Navigate to previous period
  • go - Navigate by steps

Comparison

Utilities

Helper functions for common date operations.

Types

TypeScript type definitions.

Composables

Reactive composables for frameworks.

Unit System

Plugin system for custom units.

Calendar Units

Special units for consistent calendar grids.

Quick Start

typescript
import { createTemporal, usePeriod, divide } from 'usetemporal'

// Create temporal instance
const temporal = createTemporal()

// Create reactive periods
const month = usePeriod(temporal, 'month')
const year = usePeriod(temporal, 'year')

// Divide operations
const days = divide(temporal, month.value, 'day')
const months = divide(temporal, year.value, 'month')

For a complete guide, see Getting Started.

Released under the MIT License.