ymd-js
v1.2.1
Published
Year Month Day JS
Downloads
30
Readme
General Year Month Day Utilities
In many Node.js applications, handling dates and times efficiently is crucial—whether it's for logging, scheduling, or user-facing features. This module is a collection of helper methods written in JavaScript that simplifies the extraction and manipulation of basic calendar components: year, month, and day.
These utility functions typically allow developers to:
- Retrieve the current year, month, or day.
- Format dates into readable strings (e.g.,
YYYY-MM-DD). - Convert timestamps to specific date parts.
- Perform basic date arithmetic (e.g., add days or months).
By modularizing these operations, the code becomes cleaner, more reusable, and easier to maintain. These utilities rely solely on JavaScript's built-in Date object.
Example:
const ymdjs= require("ymd-js");
console.log(ymdjs.Timestamp());
console.log(ymdjs.YMDHIS());
Output:
1746159668
2025-05-02 04:21:08