Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on May 9, 2024 via pnpm

d3-time-format 4.1.0

A JavaScript time formatter and parser inspired by strftime and strptime.
Package summary
Share
0
issues
1
license
4
ISC
Package created
3 Apr 2014
Version published
4 Dec 2021
Maintainers
2
Total deps
4
Direct deps
1
License
ISC

Issues

0
This package has no issues

Licenses

ISC License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
Cannot
hold-liable
Must
include-copyright
include-license
4 Packages, Including:
d3-array@3.2.4
d3-time-format@4.1.0
d3-time@3.1.0
internmap@2.0.3
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

1
All Dependencies CSV
β“˜ This is a list of d3-time-format 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
d3-time3.1.013.23 kBISC
prod

Visualizations

Frequently Asked Questions

What does d3-time-format do?

The "d3-time-format" is a JavaScript module that offers a comprehensive implementation of the renowned strptime and strftime functions from the C standard library. It allows you to parse and format dates in a multitude of locale-specific representations. This can be useful for converting dates to human-readable strings or vice versa. The module is frequently used by D3 time scales to create user-friendly time-axis ticks for charts.

How do you use d3-time-format?

As a JavaScript module, incorporating d3-time-format into your project involves installing it via npm, importing it, and then calling its functions as required. For example, to format the current date into a human-readable string, use the d3.timeFormat function:

const formatTime = d3.timeFormat("%B %d, %Y");
formatTime(new Date); // "June 30, 2015"

And to convert a string back to a date, you use the d3.timeParse function:

const parseTime = d3.timeParse("%B %d, %Y");
parseTime("June 30, 2015"); // Tue Jun 30 2015 00:00:00 GMT-0700 (PDT)

You can quite seamlessly create more complex conditional time formats by using d3-time:

const formatMillisecond = d3.timeFormat(".%L"),
    formatSecond = d3.timeFormat(":%S"),
    // more formatters...
    formatYear = d3.timeFormat("%Y");

function multiFormat(date) {
  return (/* function logic...*/)(date);
}

Installing d3-time-format is as simple as running npm install d3-time-format in your project's directory.

Where are the d3-time-format docs?

The documentation for d3-time-format is available in its README file on the package's GitHub repository. The readme provides a comprehensive overview of the module, installation instructions, usage examples, and an API reference detailing each of the module's functions and how to use them. Both new and experienced users will find this information valuable for understanding how to use the module effectively. Any future updates or improvements to d3-time-format will likely be reflected in this documentation.