Skip to content

Commit

Permalink
Merge pull request #167 from farhan7reza7/intDate
Browse files Browse the repository at this point in the history
Int date: integrate diff as Date Object method
  • Loading branch information
farhan7reza7 authored Mar 5, 2024
2 parents b590637 + 7c550a7 commit 30e20ed
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 4 deletions.
27 changes: 25 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,33 @@ fixed some issues and configured files for publishing diff-ymd-package v2.0.2 on

- README.md updated: Added consistent formating and recommended for best practices.


### [v3.1.0]

#### Added

- **Simplification:** Integrate diff as global Date Object method on importing
- Added source codes for integrating to Date
- Added the README.md codes for documenting integration.

#### Changed
- Updated the README.md documentation for documenting integration.
- Updated source codes
- Enhanced README.md for follwing best practices and recommended practices

#### Fixed

- Fixed some issues related to the new changes.
- Configured files for publishing diff-ymd-package v3.1.0.

#### Documentation

- README.md updated: Added consistent formating and recommended for best practices.

### [Next Release] - Collecting issues and new features for next release

### Important changes links:

- [Unreleased](https://github.com/farhan7reza7/diff-ymd-package/compare/v3.0.0...HEAD)
- [v3.0.0](https://github.com/farhan7reza7/diff-ymd-package/releases/tag/v3.0.0)
- [Unreleased](https://github.com/farhan7reza7/diff-ymd-package/compare/v3.1.0...HEAD)
- [v3.1.0](https://github.com/farhan7reza7/diff-ymd-package/releases/tag/v3.1.0)
- [Next Release](https://github.com/farhan7reza7/diff-ymd-package/milestone/2)
30 changes: 29 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,17 @@ const DatesYMD = require('diff-ymd-package'); // can use any if authenticated

```

**`OR` for version `3.1.0` and `above`**

**Can use simplified function `diff` as Global Date Object method**

```javascript
//require('@farhan7reza7/diff-ymd-package'); //or

require('diff-ymd-package'); // can use any if authenticated

```

### `Create an instance:`

```javascript
Expand All @@ -93,8 +104,25 @@ const Formatter = new DatesYMD(date1, date2);
const date1 = '2022-01-01';
const date2 = '2023-12-31';

const Formatter = DatesYMD.diffDates(date1, date2); // can use any
const Formatter = DatesYMD.diffDates(date1, date2);
```

**`OR` for version `3.1.0` and `above`**

**Can use simplified function `diff` as Global Date Object method**

```javascript
const date1 = '2022-01-01';
const date2 = '2023-12-31';

const DateInstance = new Date(date1); // create Global Date instance

const Formatter = DateInstance.diff(date2); //create an instance to `calculates the difference` between `Date instance` and the `date passed to it`

```
**Note:** For `diff` as `Global Date method`, `only one date(the date to be subtracted from/to Global Date instance)` passed to `diff method`

**`diff` method create an instance of DatesYMD to `calculates the difference` between `Date instance` and the `date passed to it`**

**Note:** For CDN based, only **DatesYMD** constructor name creates an instance, and can use diffDates as well, but only using global **DatesYMD** like **DatesYMD.diffDates(...)**

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@farhan7reza7/diff-ymd-package",
"version": "3.0.1",
"version": "3.1.0",
"description": "A javascript library for calculating the difference between two dates in formatted ways like (aY bM cD)(aYears bMonths cDays) or customized desired formats like aY-bM-cD or aYears-bMonths-cDays or kDays or mWeeks or nMonths etc.",
"main": "lib/index.js",
"scripts": {
Expand Down

0 comments on commit 30e20ed

Please sign in to comment.