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 3.1.1 to 3.1.2

11

CHANGELOG.md

@@ -308,2 +308,9 @@ ## Changelog

### [v3.1.2]
#### Fixed
- updated doc for documenting latest Global Date integration following best practices
- fixed some other issues and configured files for v2.3.2
### [Next Release] - Collecting issues and new features for next release

@@ -313,4 +320,4 @@

- [Unreleased](https://github.com/farhan7reza7/diff-ymd-package/compare/v3.1.1...HEAD)
- [v3.1.1](https://github.com/farhan7reza7/diff-ymd-package/releases/tag/v3.1.1)
- [Unreleased](https://github.com/farhan7reza7/diff-ymd-package/compare/v3.1.2...HEAD)
- [v3.1.2](https://github.com/farhan7reza7/diff-ymd-package/releases/tag/v3.1.2)
- [Next Release](https://github.com/farhan7reza7/diff-ymd-package/milestone/2)

2

package.json
{
"name": "diff-ymd-package",
"version": "3.1.1",
"version": "3.1.2",
"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.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -16,6 +16,19 @@ # diff-ymd-package

- [Installation](#installation)
- [Install from npm registry](#install-from-npm-registrypreference)
- [Install from Github Packages registry](#install-from-github-packages-registryrequire-authentication)
- [Include in html page from CDN](#include-in-html-page-from-cdn)
- [Usages](#usages)
- [For Node environment](#for-node-environment)
- [Install from npm registry](#install-from-npm-registrypreference)
- [Install from Github Packages registry](#install-from-github-packages-registryrequire-authentication)
- [For Browser environment(CDN based)](#for-browser-environmentcdn-based)
- [Include in html page from CDN](#include-in-html-page-from-cdn)
- [Set up](#initialize)
- [For Node environment](#for-node-environment-1)
- [For Browser environment(CDN based)](#for-browser-environmentcdn-based-1)
- [For diff as Global Date Object method](#for-diff-as-global-date-object-method-in-nodebrowsercdn-based)
- [Create an instance](#create-an-instance)
- [For Node environment](#for-node-environment-2)
- [For Browser environment(CDN based)](#for-browser-environmentcdn-based-2)
- [For diff as Global Date Object method](#for-diff-as-global-date-object-method-in-nodebrowsercdn-based-1)
- [Usages](#usages-for-nodebrowsercdn-baseddate-object)
- [For Node environment](#usages-for-nodebrowsercdn-baseddate-object)
- [For Browser environment(CDN based)](#usages-for-nodebrowsercdn-baseddate-object)
- [For diff as Global Date Object method](#usages-for-nodebrowsercdn-baseddate-object)
- [API References](#api-references)

@@ -30,4 +43,6 @@ - [API Documentation](#api-documentation)

### Install from `npm registry`(Preference)
### `For Node environment:`
#### Install from `npm registry`(Preference)
```bash

@@ -38,3 +53,3 @@ npm install diff-ymd-package

### Install from `Github Packages registry`(require authentication)
#### Install from `Github Packages registry`(require authentication)

@@ -49,10 +64,12 @@ ```bash

### Include in html page from `CDN`
### `For Browser environment(CDN based):`
**`OR` for version `2.2.1` and `above`**
#### Include in html page from `CDN`
**Can include in page `using script tag` from CDN**
##### for version `2.2.1` and `above`
##### Can include in page `using script tag` from CDN
```html
<script src="https://cdn.jsdelivr.net/npm/diff-ymd-package@3.0.0/lib/index.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/diff-ymd-package@3.1.1/lib/index.min.js"></script>

@@ -63,5 +80,5 @@ ```

## Usages
## Initialize
### `Initialize:`
### `For Node environment:`

@@ -75,13 +92,17 @@ ```javascript

**`OR` for version `2.2.1` and `above`**
### `For Browser environment(CDN based):`
**for version `2.2.1` and `above`**
**Can include in html page `using script tag` from `CDN`**
```html
<script src="https://cdn.jsdelivr.net/npm/diff-ymd-package@3.0.0/lib/index.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/diff-ymd-package@3.1.1/lib/index.min.js"></script>
```
**`OR` for version `3.1.0` and `above`**
### `For diff as Global Date Object method in NODE/Browser(CDN based):`
**for version `3.1.0` and `above`**
**Can use simplified function `diff` as Global Date Object method**

@@ -96,4 +117,6 @@

### `Create an instance:`
## Create an instance
### `For Node environment:`
```javascript

@@ -117,4 +140,31 @@ const date1 = '2022-01-01';

**`OR` for version `3.1.0` and `above`**
### `For Browser environment(CDN based):`
```javascript
const date1 = '2022-01-01';
const date2 = '2023-12-31';
const Formatter = new DatesYMD(date1, date2);
```
**`OR` for version 2.x.x and above**
**Can use simplified function `diffDates` on module-object(DatesYMD here)**
```javascript
const date1 = '2022-01-01';
const date2 = '2023-12-31';
const Formatter = DatesYMD.diffDates(date1, date2);
```
**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(...)**
[See an example of using CDN based](https://github.com/farhan7reza7/diff-ymd-package/wiki/CDN-based-example)
### `For diff as Global Date Object method in NODE/Browser(CDN based):`
**for version `3.1.0` and `above`**
**Can use simplified function `diff` as Global Date Object method**

@@ -131,2 +181,3 @@

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

@@ -136,6 +187,4 @@

**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(...)**
## Usages for NODE/Browser(CDN based)/Date Object
[See an example of using CDN based](https://github.com/farhan7reza7/diff-ymd-package/wiki/CDN-based-example)
### `Use methods to format difference:`

@@ -221,5 +270,7 @@

// Calculate the difference in seconds
```
## API References
**diff-ymd-package**

@@ -230,2 +281,3 @@ - [Classes](#api-documentation)

- [OR for version 2.x.x and above, Can use simplified function diffDates on module-object](#can-use-simplified-function-diffdates-on-module-object)
- [OR for version 3.1.x and above, Can use simplified function diff as Global Date Object method](#or-for-version-31x-and-above)
- [Methods](#methods)

@@ -263,4 +315,15 @@ - [diffArray()](#diffarray)

const Formatter = DatesYMD.diffDates(firstDate, secondDate); // can use any
```
#### `OR` for version 3.1.x and above
##### Can use simplified function `diff` as Global Date Object method
```javascript
const DateInstance = new Date(firstDate); // create Global Date instance
const Formatter = DateInstance.diff(secondDate); //create an instance to `calculates the difference` between `Date instance` and the `date passed to it`
```
- **`firstDate`**: The first date in the format 'yyyy-mm-dd' or 'yyyy/mm/dd' or 'yyyy.mm.dd' or dateString or dateObject

@@ -272,3 +335,3 @@ or Timestamp(epoch).

- **Special case:** empty string("" or '') is by default to current-date(today) for the parameters
- **Special case:** empty string("" or '') is by default to current-date(today) for the parameters, `but not when passed to Global Date` as firstDate above in Global Date; `for creating current date Date instance using Date`, just call empty like `new Date()`

@@ -278,3 +341,2 @@ - **`Returns:`**

### `Methods:`

@@ -281,0 +343,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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