npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

d2core

v26.1.1

Published

Core types and utilities library.

Readme

d2core

Framework-agnostic core types and utilities of the Ipesoft D2000 HTML5 UI: localization, number and date/time formatting, a pre-configured dayjs, D2000 unix time handling and predefined time intervals.

It is the base of d2coreui (React components) and has no UI dependencies.

Installation

npm install d2core dayjs

dayjs (1.x) is a peer dependency. The package is published as ES modules with TypeScript declarations.

Usage

There is no index module - import each module by its path. Every exported symbol is documented with JSDoc, so your editor shows the details on hover.

import i18n from "d2core/i18n/i18n";
import {LocaleHolder} from "d2core/i18n/localeHolder";
import {unixTimeToDayJs} from "d2core/types/unixTimeUtils";

await LocaleHolder.setLocale("sk", "sk-SK");

const amount = LocaleHolder.formatNumber(1234.5, 2);
const time = unixTimeToDayJs(1700000000).format(LocaleHolder.getDateTimeFormat(true, true));
const label = i18n("Cancel");

Call LocaleHolder.setLocale once at startup, before anything is formatted; until then English defaults are used.

Modules

| Module | Contents | |---|---| | d2core/dayjs | dayjs extended with the plugins used across the D2000 UI (isSameOrAfter, isSameOrBefore, localeData, relativeTime, isoWeek, quarterOfYear, localizedFormat, updateLocale) and a custom duration plugin (days-based durations with the DDDDD format, no months/years). Import dayjs from here to get the plugins and their types. | | d2core/dayjs/duration | The custom duration plugin and its types. | | d2core/dayjs/ambiguousTime | The plugin of the format tokens for the hour repeated at the end of the daylight saving time: Z? - the UTC offset (as Z) only in that hour, nothing elsewhere; HH? - the hour as HH, but A2 (first occurrence) / B2 (second) in that hour. LocaleHolder.getDateTimeFormat puts them in the mask for the "offsetInFold" / "hourLetter" modes. customParseFormat does not parse them; DateTimeInput does. | | d2core/i18n/i18n | Global translator (i18n(text), i18n.translator.add(...)) the UI texts are translated with. | | d2core/i18n/localeHolder | LocaleHolder - current UI language (en, sk, cs, ru, kk, sr, uk), antd/dayjs locale, number formatting and date/time/duration masks. | | d2core/types/unixTime | UnixTime type and UnixTimeConversionEnum. | | d2core/types/unixTimeUtils | Conversions between D2000 unix time and Dayjs, D2000UnixTimeNullValue and setUnixTimeConversion. | | d2core/types/timeInterval | TimeInterval and AlignMode - definition of a predefined time interval. | | d2core/types/dateTimeIntervals | DateTimeInterval - the predefined intervals by id (HOUR_ACT, DAY_PREV, WEEK_ACT, MONTH_PREV, YEAR_ACT, ...). | | d2core/types/dataChangeStateEnum | DataChangeStateEnum - kind of change of an item in a D2000 subscription update. | | d2core/utils/dateTimeUtils | DateTimeUtils - conversions of time periods between Date, Dayjs and unix time, date picker helpers. | | d2core/utils/timeUtils | TimeUtils.sleep. |

Unix time unit

D2000 unix time values are in seconds by default. An application that works with milliseconds switches the unit once at startup:

import {setUnixTimeConversion} from "d2core/types/unixTimeUtils";
import {UnixTimeConversionEnum} from "d2core/types/unixTime";

setUnixTimeConversion(UnixTimeConversionEnum.FROM_MILIS);

The switch reassigns the exported conversion functions, so always call them through the import.

Changelog

See CHANGELOG.md.