Constructor
new DatesYMD(firstDate, secondDate)
Creates an instance of DatesYMD.
Parameters:
Name | Type | Description |
---|---|---|
firstDate |
string | The first date in the format 'yyyy-mm-dd' or 'yyyy/mm/dd' or yyyy.mm.dd . |
secondDate |
string | The second date in the format 'yyyy-mm-dd' or 'yyyy/mm/dd'or yyyy.mm.dd . |
- Source:
Methods
customizeFormat(yearUnit, monthUnit, dayUnit, partSeparator) → {string}
Customizes the difference using specified units and separators like
(a + yearUnit + partSeparator + b + monthUnit + partSeparator + c +
dayUnit), eg. aYs-bMs-cDs etc.
Parameters:
Name | Type | Description |
---|---|---|
yearUnit |
string | The unit for years. |
monthUnit |
string | The unit for months. |
dayUnit |
string | The unit for days. |
partSeparator |
string | The separator between year, month, and day parts. |
- Source:
Returns:
The customized formatted difference.
- Type
- string
diffArray() → {Array}
Calculates the difference between two dates and returns an array
containing Y, M, D, and a formatted 'aY bM cD' difference string.
- Source:
Returns:
An array containing the calculated years, months, days, and the
formatted difference.
- Type
- Array
formattedYMD() → {string}
Returns the formatted difference between two dates.
- Source:
Returns:
The formatted difference in the format 'aY bM cD'.
- Type
- string