Socket
Socket
Sign inDemoInstall

@types/d3-time

Package Overview
Dependencies
0
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @types/d3-time

TypeScript definitions for d3-time


Version published
Weekly downloads
4.2M
decreased by-0.1%
Maintainers
1
Install size
30.0 kB
Created
Weekly downloads
 

Package description

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

Readme

Source

Installation

npm install --save @types/d3-time

Summary

This package contains type definitions for d3-time (https://github.com/d3/d3-time/).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/d3-time.

Additional Details

  • Last updated: Tue, 07 Nov 2023 15:11:37 GMT
  • Dependencies: none

Credits

These definitions were written by Tom Wanzek, Alex Ford, Boris Yankov, denisname, and Nathan Bierema.

FAQs

Last updated on 07 Nov 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc