Skip to content

Commit

Permalink
updated for diff-ymd-package v1.0.4 publishing on npm registry
Browse files Browse the repository at this point in the history
  • Loading branch information
farhan7reza7 committed Jan 17, 2024
1 parent 51ec1d5 commit 9c0c167
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 39 deletions.
18 changes: 12 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
All notable changes to diff-ymd-package will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and follows the guidelines from [Keep a Changelog](https://keepachangelog.com/).

### [Unreleased] - 2024-01-15
### [Unreleased]

#### Added

Expand All @@ -13,11 +13,11 @@ and follows the guidelines from [Keep a Changelog](https://keepachangelog.com/).
- Includes methods for creating instances, calculating differences, and formatting results.
- Unit tests using Jest for comprehensive testing.

### [v1.0.0-beta.1] - 2024-01-15 5:15 pm
### [v1.0.0-beta.1]

### [v1.0.0-beta.1] - 2024-01-15 9:30 pm🕤
### [v1.0.0-beta.2]

### [v1.0.0] - 2024-01-16
### [v1.0.0]

#### Fixed

Expand All @@ -41,10 +41,16 @@ fixed some issues and configured files for publishing diff-ymd-package v1.0.2 on

fixed some issues and configured files for publishing diff-ymd-package v1.0.3 on npm registry

### [v1.0.4]

#### Fixed

fixed some issues and configured files for publishing diff-ymd-package v1.0.4 on npm registry

### [Next Release] - Planning release time

### Important changes links:

- [Unreleased](https://github.com/farhan7reza7/diff-ymd-package/compare/v1.0.3...HEAD)
- [v1.0.3](https://github.com/farhan7reza7/diff-ymd-package/releases/tag/v1.0.3)
- [Unreleased](https://github.com/farhan7reza7/diff-ymd-package/compare/v1.0.4...HEAD)
- [v1.0.4](https://github.com/farhan7reza7/diff-ymd-package/releases/tag/v1.0.4)
- [Next Release](https://github.com/farhan7reza7/diff-ymd-package/milestone/2)
61 changes: 41 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# diff-ymd-package

[![pages-build-deployment](https://github.com/farhan7reza7/diff-ymd-package/actions/workflows/pages/pages-build-deployment/badge.svg)](https://github.com/farhan7reza7/diff-ymd-package/actions/workflows/pages/pages-build-deployment)
> `diff-ymd-package` a javascript package provides APIs to difference dates in formatted ways(like (aYears bMonths cDays) or (aY bM cD) etc., eg. age = 20Y 2M 23D or datesDifference = 2Years 11Months 20Days)
[![NPM Version](https://img.shields.io/npm/v/diff-ymd-package)](https://www.npmjs.com/package/diff-ymd-package)

[![License](https://img.shields.io/github/license/farhan7reza7/diff-ymd-package)](https://opensource.org/licenses/MIT)

diff-ymd-package provides api to difference dates in formatted ways(like (aYears bMonths cDays) or (aY bM cD), eg. age = 20Y 2M 23D or datesDifference = 2Years 11Months 20Days)
[![NPM Version][npm-image]][npm-url]
[![CI][ci-image]][ci-url]
[![License][license-image]][licence-url]

## Installation

Expand Down Expand Up @@ -35,11 +33,26 @@ const date1 = '2022-01-01';
const date2 = '2023-12-31';

const calculator = new DatesYMD(date1, date2);

const result = calculator.formattedYMD();
const resultArray = calculator.diffArray();

console.log(result); // Output: "1Y 11M 30D"
// formatted output in aY bM cD format

console.log(resultArray); // Output: [1, 11, 30, '1Y 11M 30D']
/* 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.*/

/*example:
let Y, M, D;
Y = resultArray[0];
M = resultArray[1];
D = resultArray[2];
const customFormat = Y + 'years ' + M + 'months ' + D + 'days';
console.log(customFormat); // output: 1years 11months 30days
*/
```

## API Documentation
Expand All @@ -51,7 +64,7 @@ Represents a utility class for calculating the difference between two dates.
#### Create an instance of `DatesYMD`:

```javascript
const calculator = new DatesYMD(firstDate, secondDate);
const Formatter = new DatesYMD(firstDate, secondDate);
```

- **`firstDate`**: The first date in the format 'yyyy-mm-dd' or 'yyyy/mm/dd' or 'yyyy.mm.dd'.
Expand All @@ -70,36 +83,44 @@ const result = calculator.diffArray();
An array containing the calculated years, months, days, and the formatted difference.

**`formattedYMD()`**
Returns the formatted difference between two dates in aYears bMonths cDays(aY bM cD) format.
Returns the formatted difference between two dates in aY bM cD(aYears bMonths cDays) format.

```javascript
const result = calculator.formattedYMD();
```

- **`Returns:`** A string in the format 'aY bM cD'.

[For more information, check out diff-ymd-package documentation](https://farhan7reza7.github.io/diff-ymd-package/DatesYMD.html)
[For more information, see `diff-ymd-package documentation`](https://farhan7reza7.github.io/diff-ymd-package/DatesYMD.html)

## Contributing

If you find any issues or have suggestions for improvement, please open an issue or create a pull request on the GitHub repository.

## License
See [CONTRIBUTING.md](CONTRIBUTING.md) for more informations.

- This project is licensed under the MIT License - see the LICENSE file for details.
[License here](https://github.com/farhan7reza7/diff-ymd-package/blob/main/LICENSE)
## Best Practices:

## Additional Notes

### Best Practices`:`

#### The code adheres to recommended practices for readability and maintainability, including:
### The code adheres to recommended practices for readability and maintainability, including:

- Meaningful variable and function names for clarity.
- Clear and concise comments to enhance understanding.
- Proper indentation and formatting for visual organization.

### Important Links`:`
## License

This project is licensed under the MIT License - see the LICENSE file for details.

[See License](https://github.com/farhan7reza7/diff-ymd-package/blob/main/LICENSE)

## History

For more details about what has changed in each version of this project, see the CHANGELOG.
See [CHANGELOG.md](CHANGELOG.md).

- For more details about what has changed in each version of this project, please see the CHANGELOG.
[CHANGELOG here](https://github.com/farhan7reza7/diff-ymd-package/blob/main/CHANGELOG.md)
[npm-image]: https://img.shields.io/npm/v/diff-ymd-package
[npm-url]: https://www.npmjs.com/package/diff-ymd-package
[ci-image]: https://github.com/farhan7reza7/diff-ymd-package/actions/workflows/pages/pages-build-deployment/badge.svg
[ci-url]: https://github.com/farhan7reza7/diff-ymd-package/actions/workflows/pages/pages-build-deployment
[license-image]: https://img.shields.io/github/license/farhan7reza7/diff-ymd-package
[licence-url]: https://opensource.org/licenses/MIT
29 changes: 16 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
{
"name": "diff-ymd-package",
"version": "1.0.3",
"description": "Utility class for calculating the difference between two dates in (aYears bMonths cDays)(aY bM cD) format.",
"name": "@farhan7reza7/diff-ymd-package",
"version": "1.0.4",
"description": "Utility class for calculating the difference between two dates in (aY bM cD)(aYears bMonths cDays) or customized formats like aY-bM-cD or aYears-bMonths-cDays etc.",
"main": "src/diff-ymd.js",
"scripts": {
"test": "jest"
},
"keywords": [
"date",
"diff-ymd-package",
"ymd",
"diff-ymd",
"diff",
"dates",
"formatted difference",
"formatted dates difference",
"formatted",
"aY bM cD",
"aYears bMonths cDays",
"utility",
"difference",
"npm",
"package"
"formatted-difference",
"formatted-dates-difference",
"age-finder",
"age",
"customized-format",
"aY-bM-cD",
"aYears-bMonths-cDays",
"dates-difference"
],
"author": "Farhan Reza",
"license": "MIT",
Expand All @@ -34,7 +37,7 @@
"url": "git+https://github.com/farhan7reza7/diff-ymd-package.git"
},
"bugs": {
"url": "https://github.com/farhan7reza7/diff-ymd-package/blob/main/.github/ISSUE_TEMPLATE/ISSUE_TEMPLATE.md"
"url": "https://github.com/farhan7reza7/diff-ymd-package/issues/new/choose"
},
"homepage": "https://github.com/farhan7reza7/diff-ymd-package/blob/main/README.md"
}

0 comments on commit 9c0c167

Please sign in to comment.