format-date-package
v1.0.3
Published
A simple and lightweight npm package for formatting JavaScript and TypeScript `Date` objects into the `yyyy-mm-dd` format.
Downloads
273
Maintainers
Readme
Date Formatter
A simple and lightweight npm package for formatting JavaScript and TypeScript Date
objects into the yyyy-mm-dd
format.
Features
- Supports both JavaScript and TypeScript.
- Simple API to format
Date
objects. - Lightweight with minimal dependencies.
Installation
You can install the package via npm:
npm install format-date-package
## Usage
### JavaScript Example
In a JavaScript file, you can import and use the formatDate function like this:
const { formatDate } = require('format-date-package');
const date = new Date();
const formattedDate = formatDate(date);
console.log(formattedDate); // Example Output: "2024-11-12"
### TypeScript Example
In TypeScript, the usage is similar, and you'll benefit from type safety:
import { formatDate } from 'format-date-package';
const date = new Date();
const formattedDate = formatDate(date);
console.log(formattedDate); // Example Output: "2024-11-12"
## Contact
Author: Abhijith
Email: [email protected]