New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

@time-provider/plugin-dayjs

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@time-provider/plugin-dayjs

Day.js plugin for Time-Provider. Inject time. Control it in tests.

latest
Source
npmnpm
Version
0.7.0
Version published
Maintainers
1
Created
Source

NPM jsr jsr score types Node.js ^18.18 || >=20.4 Deno ~1.39.1 || >=1.43 module ESM + CJS CodeQL check codecov npm downloads dependencies unpacked-size minified size openssf best practices license

Time-Provider ~ Day.js plugin

Time-Provider

Description

This is the Day.js plugin for Time-Provider.

Usage

import { createTimeProvider } from "@time-provider/core";
import { createTimeProvider as createDeterministicTimeProvider } from "@time-provider/core/deterministic";
import { plugin } from "@time-provider/plugin-dayjs";
import { plugin as deterministicPlugin } from "@time-provider/plugin-dayjs/deterministic";

// System: real clock and timers, in the given timezone.
const timeProvider = createTimeProvider.for(plugin).withTimezone("Europe/Paris").create();
timeProvider.clock.localNow(); // a Day.js Dayjs

// Deterministic: a simulated clock that only moves when you move it.
using manual = createDeterministicTimeProvider
  .for(deterministicPlugin)
  .asManual()
  .withInitialTime("2026-01-01T00:00:00.000Z")
  .create();
manual.clock.moveBy({ hours: 1 });
manual.clock.utcNow(); // 2026-01-01T01:00:00.000Z

Changelog

See CHANGELOG.md

Keywords

clock

FAQs

Package last updated on 28 Sep 2026

Related posts