Day.js
bash
npm install @time-provider/core @time-provider/plugin-dayjsts
// production
import { createTimeProvider } from "@time-provider/core";
import { plugin } from "@time-provider/plugin-dayjs";
const timeProvider = createTimeProvider.for(plugin).withTimezone("America/New_York").create();
timeProvider.clock.utcNow(); // dayjs.Dayjs, in UTC
timeProvider.clock.localNow(); // dayjs.Dayjs, in America/New_Yorkts
// tests — same date type, from the /deterministic subpath
import { createTimeProvider } from "@time-provider/core/deterministic";
import { plugin } from "@time-provider/plugin-dayjs/deterministic";
const timeProvider = createTimeProvider.for(plugin).asFixed().withFixedTime(0).create();- Date type:
dayjs.Dayjs. - Peer dependency:
dayjs(the plugin itself extends it withdayjs/plugin/utcanddayjs/plugin/timezone). - Timezone support: full —
ISystemPlugin/ITimeProvider(orIDeterministicPluginon the/deterministicside), real IANA zones via.withTimezone(...)/clock.localNow().
Pick this if your codebase already uses Day.js for its small footprint and Moment-like API.