Socket
Socket
Sign inDemoInstall

@types/d3-time

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/d3-time

TypeScript definitions for d3-time


Version published
Weekly downloads
5M
decreased by-2.32%
Maintainers
1
Weekly downloads
 
Created

What is @types/d3-time?

The @types/d3-time package provides TypeScript type definitions for d3-time, a module in the D3.js library that allows for precise manipulation and formatting of dates for visualization purposes. It enables developers to work with time intervals, create time scales, and format dates in a way that's compatible with D3's visualization tools.

What are @types/d3-time's main functionalities?

Creating Time Intervals

This feature allows you to create an array of dates representing each year (or other time interval) between a start and end date. It's useful for generating axes and labels in time-based charts.

import { timeYear } from 'd3-time';
const start = new Date(2020, 0, 1);
const end = new Date(2021, 0, 1);
const years = timeYear.range(start, end);

Rounding and Snapping Dates

This feature enables rounding a date to the nearest time interval (e.g., month). It's useful for normalizing dates, such as snapping user-selected dates to the nearest month in a time series analysis.

import { timeMonth } from 'd3-time';
const date = new Date(2020, 6, 10);
const rounded = timeMonth.round(date);

Filtering Dates

This feature allows filtering dates to only include those that match a specific time interval (e.g., every Monday). It's useful for creating custom time scales that, for example, only include business days.

import { timeMonday } from 'd3-time';
const start = new Date(2020, 0, 1);
const end = new Date(2020, 1, 1);
const mondays = timeMonday.every(1).range(start, end);

Other packages similar to @types/d3-time

FAQs

Package last updated on 07 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc