vega-time is a JavaScript utility package providing a suite of date and time manipulation functions specifically designed for use within the Vega visualization ecosystem. It offers functionalities for parsing, formatting, flooring, and ceiling time values, crucial for handling temporal data in data visualizations. As part of the larger Vega monorepo, its development is closely aligned with Vega's evolution, ensuring seamless integration. The current stable version of the Vega monorepo is v6.2.0, with vega-time benefiting from this active development cycle which includes regular minor and patch releases. A significant change in the v6 series is the transition to an ESM-only distribution, impacting how the library is imported and used in modern JavaScript environments. This package differentiates itself by offering robust, performant time utilities tailored for data visualization contexts, handling various time units and interval operations that are common in charting and graphing.
npm install vega-timeVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to import and use core vega-time functions for formatting, parsing, flooring, and offsetting dates using various time intervals.
Update all import statements from 'require("pkg")' to 'import { Symbol } from "pkg";' and ensure your project is configured for ESM (e.g., '"type": "module"' in package.json or using .mjs file extensions).Upgrade to vega v5.33.1 or later to mitigate the security vulnerability. For v6 users, the fix is implicitly included.
Upgrade to vega v6.0.0 or later to ensure proper handling of string datetimes within expressions and interpreters.
Ensure your environment supports `Object.hasOwn` (Node.js >= 16.9.0, modern browsers). For older environments, a polyfill might be necessary if experiencing issues, though this is primarily an internal implementation detail.
Change 'const { timeFormat } = require("vega-time");' to 'import { timeFormat } from "vega-time";'. Ensure your package.json has '"type": "module"' or use .mjs file extensions.Carefully review the `timeParse` format specifiers (e.g., '%Y' for full year, '%m' for month, '%d' for day) and ensure they precisely map to your input string's structure. Test with known valid date strings and their corresponding formats.
No dependency data recorded yet.