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

@time-provider/plugin-native

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-native

Time-Provider : Native Date plugin ~ Your single time interface for all your JavaScript / TypeScript projects.

Source
npmnpm
Version
0.6.1
Version published
Weekly downloads
6
-45.45%
Maintainers
1
Weekly downloads
 
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 ~ Native plugin

Time-Provider

Description

This is the native Date 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-native";
import { plugin as deterministicPlugin } from "@time-provider/plugin-native/deterministic";

// System: real clock and timers. This plugin is UTC-only.
const timeProvider = createTimeProvider.for(plugin).create();
timeProvider.clock.utcNow(); // a native Date

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

Notes

JavaScript's native Date object lacks a time zone-aware object type that stores and performs arithmetic in a specific time zone.

As a result, Time-Provider intentionally does not expose time zone or local-time APIs for Date.
This plugin provides a UTC-only facade.

If you need first-class time zone support, consider using Temporal together with the Time-Provider Temporal plugin.

If you need to keep using the native Date object, you can extend it by adding time zone support with the date-fns and date-fns-tz, outside the scope of Time-Provider.

Changelog

See CHANGELOG.md

Keywords

clock

FAQs

Package last updated on 26 Sep 2026

Related posts