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 2.0.2 to 2.0.3

24

.github/ISSUE_TEMPLATE/1-bug.md

@@ -8,20 +8,21 @@ ---

**Description**
**Description:**
[Provide a brief description of the bug]
<!--[Provide a brief description of the bug]-->
**Steps to Reproduce**
**Steps to Reproduce:**
[Outline the steps to reproduce the bug]
<!--[Outline the steps to reproduce the bug]-->
**Expected Behavior**
**Expected Behavior:**
[Describe what you expected to happen]
<!--[Describe what you expected to happen]-->
**Actual Behavior**
**Actual Behavior:**
[Describe what actually happened]
<!--[Describe what actually happened]-->
**Versions**
**Versions (if applicable):**
<!--
- diff-ymd-package version: [e.g., 1.0.0]

@@ -31,5 +32,6 @@ - Node.js version: [e.g., 14.17.5]

- Browser [e.g. chrome]
-->
**Additional Information (if applicable)**
**Additional Information (if applicable):**
[Include any additional information, logs, or screenshots]
<!--[Include any additional information, logs, or screenshots]-->

@@ -10,14 +10,14 @@ ---

If you have ideas for new features or improvements, please share them here. We value your input!
<!--If you have ideas for new features or improvements, please share them here. We value your input!-->
**Feature Description**
**Feature Description:**
[A clear and concise description of the feature.]
<!--[A clear and concise description of the feature.]-->
**Reason for the Feature**
**Reason for the Feature:**
[Explain why this feature would be beneficial.]
<!--[Explain why this feature would be beneficial.]-->
**Additional Information**
**Additional Information (if applicable):**
[Any additional context or information that may be relevant.]
<!--[Any additional context or information that may be relevant.]-->

@@ -8,31 +8,34 @@ ---

**Welcome to the Issues Page for diff-ymd-package**
**Welcome to the Issues Page for diff-ymd-package:**
If you encounter any problems, bugs, or have suggestions for improvement, please report them here. We appreciate your feedback!
<!--If you encounter any problems, bugs, or have suggestions for improvement, please report them here. We appreciate your feedback!-->
#### Before You Report
#### Before You Report:
<!--
- Ensure that you are using the latest version of DatesYMD.
- Search existing issues to avoid duplication.
-->
#### Issue Report
### Issue Report:
**Description**
**Description:**
[Provide a brief description of the issue]
<!--[Provide a brief description of the issue]
**Steps to Reproduce**
[Outline the steps to reproduce the issue]
<!--[Outline the steps to reproduce the issue]-->
**Expected Behavior**
**Expected Behavior(if applicable):**
[Describe what you expected to happen]
<!--[Describe what you expected to happen]-->
**Actual Behavior**
**Actual Behavior(if applicable):**
[Describe what actually happened]
<!--[Describe what actually happened]-->
**Versions**
**Versions(if applicable):**
<!--
- diff-ymd-package version: [e.g., 1.0.0]

@@ -42,5 +45,6 @@ - Node.js version: [e.g., 14.17.5]

- Browser [e.g. chrome]
-->
**Additional Information (if applicable)**
**Additional Information (if applicable):**
[Include any additional information, logs, or screenshots]
<!--[Include any additional information, logs, or screenshots]-->

@@ -10,2 +10,2 @@ ---

[Describe your issue here]
<!--[Describe your issue here]-->

@@ -5,18 +5,19 @@ # Pull Request

[Provide a brief description of the changes made in this pull request]
<!--[Provide a brief description of the changes made in this pull request]-->
## Related Issue
[If applicable, reference the related issue]
<!--[If applicable, reference the related issue]-->
## Changes Made
[Briefly List the main changes made in this pull request]
<!--[Briefly List the main changes made in this pull request]-->
## Screenshots (if applicable)
[Include any relevant screenshots]
<!--[Include any relevant screenshots]-->
## Checklist
<!--
- [ ] I have tested these changes thoroughly

@@ -26,2 +27,2 @@ - [ ] My code follows the project's coding standards

- [ ] I have updated the README if needed (Optional)
-->

@@ -138,2 +138,14 @@ ## Changelog

### [v2.0.3]
#### Fixed
- formatted readme documentation for better presentation
- added wiki for diff-ymd-package better docummentation
- updated diff-ymd-package gh-pages documention
- updated varaibles keywords to modern Js keywords
- fixed some other issues and configured files for v2.0.3
### [Next Release] - Collecting issues and new features for next release

@@ -143,4 +155,4 @@

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

@@ -1,2 +0,2 @@

### diff-ymd-package's Code of Conduct:
### `diff-ymd-package's Code of Conduct:`

@@ -3,0 +3,0 @@ #### Our Pledge

{
"name": "diff-ymd-package",
"version": "2.0.2",
"version": "2.0.3",
"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": "src/diff-ymd.js",

# diff-ymd-package
> `diff-ymd-package` a `javascript library` 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) or customized desired formats like aY-bM-cD or aYears-bMonths-cDays or kDays or mWeeks or nMonths etc.
> `diff-ymd-package` a `javascript library` 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`) or customized desired formats like `aY-bM-cD` or `aYears-bMonths-cDays` or `kDays` or `mWeeks` or `nMonths` etc.

@@ -10,2 +10,3 @@ [![NPM Version][npm-image]][npm-url]

[![License][license-image]][licence-url]
[![LinkedIn](https://img.shields.io/badge/LinkedIn-farhan7reza7-blue)](https://www.linkedin.com/in/farhan7reza7/)

@@ -30,6 +31,6 @@ ## Installation

**Initialize**
### `Initialize:`
```javascript
//const DatesYMD = require('@farhan7reza7/diff-ymd-package'); or
//const DatesYMD = require('@farhan7reza7/diff-ymd-package'); //or

@@ -39,3 +40,3 @@ const DatesYMD = require('diff-ymd-package'); // can use any

**Create an instance**
### `Create an instance:`

@@ -60,4 +61,4 @@ ```javascript

**Use methods to format difference**
### `Use methods to format difference:`
```javascript

@@ -95,3 +96,3 @@ // format output in aY bM cD format

**Formatted Outputs**
### `Formatted Outputs:`

@@ -154,5 +155,4 @@ ```javascript

#### `OR` for version 2.x.x and above
##### Can use simplified function `diffDates` on module-object
**Can use simplified function `diffDates` on module-object**
```javascript

@@ -176,6 +176,7 @@ //const DatesYMD = require('@farhan7reza7/diff-ymd-package'); or

#### Methods:
##### `diffArray()`
### `Methods:`
- #### `diffArray()`
Calculates the difference between two dates and returns an array containing Y(years), M(months), D(days), and a formatted 'aY bM cD' difference string.

@@ -187,7 +188,8 @@

- **`Returns:`**
An array containing the calculated years, months, days, and the formatted difference.
**`Returns:`**
An array containing the calculated years, months, days, and the formatted difference.
##### `formattedYMD()`
- #### `formattedYMD()`
Returns the formatted difference between two dates in aY bM cD(aYears bMonths cDays) format.

@@ -199,6 +201,7 @@

- **`Returns:`** A string in the format 'aY bM cD'.
**`Returns:`** A string in the format 'aY bM cD'.
##### `customizeFormat(yearUnit, monthUnit, dayUnit, partSeparator)`
- #### `customizeFormat(yearUnit, monthUnit, dayUnit, partSeparator)`
Customizes the difference using specified units and separators

@@ -215,6 +218,7 @@

- **`Returns:`** A customized formatted difference string of form (a + yearUnit + partSeparator + b + monthUnit + partSeparator + c + dayUnit), eg. aYs-bMs-cDs etc.
**`Returns:`** A customized formatted difference string of form (a + yearUnit + partSeparator + b + monthUnit + partSeparator + c + dayUnit), eg. aYs-bMs-cDs etc.
##### `diffInMonths()`
- #### `diffInMonths()`
Calculates the difference in months between two dates.

@@ -226,6 +230,7 @@

- **Returns:** The difference in months.
**Returns:** The difference in months.
##### `diffInWeeks()`
- #### `diffInWeeks()`
Calculates the difference in weeks between two dates.

@@ -237,6 +242,7 @@

- **Returns:** The difference in weeks.
**Returns:** The difference in weeks.
##### `diffInDays()`
- #### `diffInDays()`
Calculates the difference in days between two dates.

@@ -248,6 +254,7 @@

- **Returns:** The difference in days.
**Returns:** The difference in days.
##### `diffInYears()`
- #### `diffInYears()`
Calculates the difference in years between two dates.

@@ -259,6 +266,7 @@

- **Returns:** The difference in years.
**Returns:** The difference in years.
##### `diffInHours()`
- #### `diffInHours()`
Calculates the difference in hours between two dates.

@@ -270,6 +278,7 @@

- **Returns:** The difference in hours.
**Returns:** The difference in hours.
##### `diffInMinutes()`
- #### `diffInMinutes()`
Calculates the difference in minutes between two dates.

@@ -281,6 +290,7 @@

- **Returns:** The difference in minutes.
**Returns:** The difference in minutes.
##### `diffInSeconds()`
- #### `diffInSeconds()`
Calculates the difference in seconds between two dates.

@@ -292,5 +302,6 @@

- **Returns:** The difference in seconds.
**Returns:** The difference in seconds.<br>
For more informations, [See `diff-ymd-package documentation`](https://farhan7reza7.github.io/diff-ymd-package/global.html)
### `For more information:`
[See `diff-ymd-package Documentation`](https://farhan7reza7.github.io/diff-ymd-package/global.html)

@@ -328,5 +339,5 @@ ## Contributing

[github-url]: https://github.com/farhan7reza7/diff-ymd-package/actions/workflows/npm-publish-github-packages.yml
[ci-image]: https://github.com/farhan7reza7/diff-ymd-package/actions/workflows/pages/pages-build-deployment/badge.svg
[ci-image]: https://github.com/farhan7reza7/diff-ymd-package/actions/workflows/pages/pages-build-deployment/badge.svg?branch=main
[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

@@ -22,3 +22,3 @@ /**

this.handleEmpty = function () {
var firstD, secondD;
let firstD, secondD;
if (this.firstDate === '' && this.secondDate === '') {

@@ -43,3 +43,3 @@ firstD = new Date();

if (firstD.getTime() < secondD.getTime()) {
var negativeHandle = firstD;
let negativeHandle = firstD;
firstD = secondD;

@@ -53,4 +53,3 @@ secondD = negativeHandle;

this.initDiff = function () {
var dates, firstD, secondD;
let firstD, secondD, dates, swapped;
// Handle empty date inputs by defaulting to the current date

@@ -61,3 +60,3 @@ dates = this.handleEmpty();

// Swap dates if the first date is smaller than the second date
var swapped = this.swapDates(firstD, secondD);
swapped = this.swapDates(firstD, secondD);
if (swapped) {

@@ -78,4 +77,4 @@ (firstD = swapped[0]), (secondD = swapped[1]);

diffArray() {
var datesDiff, year, month, day, monthAdjuster, firstD, secondD;
var dates, yearS, yearF, monthS, monthF, dateS, dateF;
let year, month, day, monthAdjuster;
let firstD, secondD, dates, yearS, yearF, monthS, monthF, dateS, dateF, datesDiff;

@@ -218,3 +217,3 @@ // initializing dates difference

diffInMonths() {
var ymdArray, year, month;
let ymdArray, year, month;

@@ -240,3 +239,3 @@ // initializing dates difference

diffInWeeks() {
let dates, weeks, firstD, secondD;
let dates, firstD, secondD;

@@ -248,3 +247,3 @@ // initializing dates difference

// calculate weeks
weeks = Math.floor(
const weeks = Math.floor(
(firstD.getTime() - secondD.getTime()) / (7 * 24 * 60 * 60 * 1000),

@@ -263,3 +262,3 @@ );

diffInDays() {
let dates, days, firstD, secondD;
let dates, firstD, secondD;

@@ -271,3 +270,3 @@ // initializing dates difference

// calculate days
days = Math.floor(
const days = Math.floor(
(firstD.getTime() - secondD.getTime()) / (24 * 60 * 60 * 1000),

@@ -286,3 +285,3 @@ );

diffInYears() {
let ymdArray, years;
let ymdArray;

@@ -293,3 +292,3 @@ // get dates difference array

// Extract year component of the difference
years = ymdArray[0];
const years = ymdArray[0];

@@ -388,3 +387,3 @@ return years;

function handleEmpty() {
var firstD, secondD;
let firstD, secondD;
if (firstDate === '' && secondDate === '') {

@@ -416,3 +415,3 @@ firstD = new Date();

if (firstD.getTime() < secondD.getTime()) {
var negativeHandle = firstD;
let negativeHandle = firstD;
firstD = secondD;

@@ -431,3 +430,4 @@ secondD = negativeHandle;

function initDiff() {
var dates, firstD, secondD;
let firstD, secondD;
let dates, swapped;

@@ -439,3 +439,3 @@ // Handle empty date inputs by defaulting to the current date

// Swap dates if the first date is smaller than the second date
var swapped = swapDates(firstD, secondD);
swapped = swapDates(firstD, secondD);
if (swapped) {

@@ -454,6 +454,6 @@ [firstD, secondD] = swapped;

*/
diffArray: function () {
var datesDiff, year, month, day, monthAdjuster, firstD, secondD;
var dates, yearS, yearF, monthS, monthF, dateS, dateF;
diffArray: function () {
let year, month, day, monthAdjuster;
let firstD, secondD, dates, yearS, yearF, monthS, monthF, dateS, dateF, datesDiff;
// initializing dates difference

@@ -592,3 +592,3 @@ dates = initDiff();

diffInMonths: function () {
var ymdArray, year, month;
let ymdArray, year, month;

@@ -595,0 +595,0 @@ // initializing dates difference

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