@nybr.js/semverize
v1.0.1
Published
Semverize ESModule: semverizes difference between two dates
Downloads
1
Maintainers
Readme
@nybr.js/semverize v1.0.1
Semverize ESModule: semverizes difference between two dates.
Table of Contents
Installation
Install this package using NPM.
$ npm install --save @nybr.js/semverize
Usage
The module consists of one method and can be used as following.
// Import/require the module
const semverize = require("@nybr.js/semverize");
// Use the result of the semverize function
const result = semverize(fromDate, toDate[, prefix]);
Parameters
- fromDate: Date object (required)
- Date used as the beginning of the difference
- toDate: Date object (required)
- Date used as the end of the difference
- prefix: String (optional)
- Possible prefix, e.g. 'v'
Examples
Example without a prefix.
// Returns '5.9.5'
semverize(new Date("2000-07-05"), new Date("2006-04-10"));
Example with a prefix.
// Returns 'v5.9.5'
semverize(new Date("2000-07-05"), new Date("2006-04-10"), "v");
Example with an invalid date.
// Returns 'N/A'
semverize(new Date("2000-07-05"), null);
Issues
If you have any issues or questions about this module, you can contact me on [email protected].