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 4, 2024 via pnpm

dateformat 5.0.3

A node.js package for Steven Levithan's excellent dateFormat() function.
Package summary
Share
0
issues
1
license
1
MIT
Package created
13 Mar 2011
Version published
19 Feb 2022
Maintainers
6
Total deps
1
Direct deps
0
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
dateformat@5.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

0
All Dependencies CSV
β“˜ This is a list of dateformat 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does dateformat do?

The dateformat library is a useful Node.js package inspired by the excellent dateFormat() function by Steven Levithan. The package comes in handy when needing to handle date formatting in JavaScript. With this, you can neatly manipulate date strings to different formats depending on your requirements.

How do you use dateformat?

The usage of the dateformat package is straightforward, initiated by installing the package via npm using the command npm install dateformat. After that, you can import it into your JavaScript code and use it as per your necessitations.

Below are a few usage examples:

import dateFormat, { masks } from "dateformat";
const now = new Date();

// Basic usage
dateFormat(now, "dddd, mmmm dS, yyyy, h:MM:ss TT"); 
//Result: Saturday, June 9th, 2007, 5:46:21 PM

// Using named masks
dateFormat(now, "isoDateTime"); 
// Result: 2007-06-09T17:46:21

// Adding your own custom mask
masks.hammerTime = 'HH:MM! "Can\'t touch this!"';
dateFormat(now, "hammerTime"); 
// Result: 17:46! Can't touch this!

// Providing the date as a string
dateFormat("Jun 9 2007", "fullDate"); 
// Result: Saturday, June 9, 2007

Realize that the function accepts three parameters and if you don't include the date argument, the current date and time is used. If you don't include the mask argument, then dateFormat.masks.default is used instead.

Where are the dateformat docs?

The detailed documentation for dateformat can be located on the package's Github page here. The readme provides comprehensive information on how to use the library, including modifications, usage examples, mask options, named formats, and localization details. Therefore, it's your go-to resource when seeking to understand the package's workings fully.