Socket
Socket
Sign inDemoInstall

diff-ymd-package

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

diff-ymd-package - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

12

CHANGELOG.md

@@ -77,4 +77,10 @@ ## Changelog

fixed some issues and configured files for v1.0.1
fixed some issues and configured files for v1.1.1
### [v1.1.2]
#### Fixed
fixed some issues and configured files for v1.1.2
### [Next Release] - Planning release time

@@ -84,4 +90,4 @@

- [Unreleased](https://github.com/farhan7reza7/diff-ymd-package/compare/v1.1.1...HEAD)
- [v1.1.1](https://github.com/farhan7reza7/diff-ymd-package/releases/tag/v1.1.1)
- [Unreleased](https://github.com/farhan7reza7/diff-ymd-package/compare/v1.1.2...HEAD)
- [v1.1.2](https://github.com/farhan7reza7/diff-ymd-package/releases/tag/v1.1.2)
- [Next Release](https://github.com/farhan7reza7/diff-ymd-package/milestone/2)
{
"name": "diff-ymd-package",
"version": "1.1.1",
"version": "1.1.2",
"description": "Utility class for calculating the difference between two dates in formatted ways like (aY bM cD)(aYears bMonths cDays) or customized formats like aY-bM-cD or aYears-bMonths-cDays etc.",

@@ -5,0 +5,0 @@ "main": "src/diff-ymd.js",

@@ -27,4 +27,5 @@ # diff-ymd-package

## Usage
## Usages
**Initialize**
```javascript

@@ -35,2 +36,5 @@ //const DatesYMD = require('@farhan7reza7/diff-ymd-package'); or

```
**Create an instance**
```javascript
const date1 = '2022-01-01';

@@ -41,8 +45,23 @@ const date2 = '2023-12-31';

const result = Formatter.formattedYMD();
const resultArray = Formatter.diffArray();
```
**Use methods to format difference**
```javascript
// format output in aY bM cD format
const result = Formatter.formattedYMD(); // Output: "1Y 11M 30D"
// create format of your choice
const customizedFormat = Formatter.customizeFormat('Y', 'Ms', 'Ds', '-'); // Output: "1Y-11Ms-30Ds"
// return an array having years, months, days, and the formatted difference
const resultArray = Formatter.diffArray(); // Output: [1, 11, 30, '1Y 11M 30D']
```
**Formatted Outputs**
```javascript
console.log(result); // Output: "1Y 11M 30D"
// formatted output in aY bM cD format
console.log(customizedFormat); // Output: "1Y-11Ms-30Ds"
// you can use this method for creating format of your choice
console.log(resultArray); // Output: [1, 11, 30, '1Y 11M 30D']

@@ -62,6 +81,2 @@ /* you can access each of Y, M, D separately from output array and can format as per your choice like aY-bM-cD or aYears-bMonths-cDays etc.*/

// you can use this method for creating format of your choice
const customizedFormat = Formatter.customizeFormat('Y', 'Ms', 'Ds', '-');
console.log(customizedFormat); // Output: "1Y-11Ms-30Ds"
```

@@ -68,0 +83,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc