Skip to content

Commit

Permalink
fix: update description
Browse files Browse the repository at this point in the history
  • Loading branch information
lubega-deriv committed Sep 25, 2024
1 parent f1d90a8 commit 47fd41c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 20 deletions.
16 changes: 8 additions & 8 deletions src/utils/format.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,16 @@ export const formatMoney = (number: number, options?: FormatMoneyOptions) => {
/**
* Converts and formats a given date input into a specified string format without usage of external libraries such as moment.js or date-fns.
*
* @param {Date | number | string} dateInput - The date to be formatted. Can be a Date object, Unix timestamp, or date string.
* @param {Intl.DateTimeFormatOptions} [options] - Optional configuration for date formatting. Defaults to { day: "2-digit", month: "2-digit", year: "numeric" }.
* @param {string} [format="YYYY-MM-DD"] - The desired output format. Supported formats: 'YYYY-MM-DD', 'DD MMM YYYY', 'MMM DD YYYY'.
* @param {Date | number | string} dateInput - The date to be formatted.
* - Can be a Date object, Unix timestamp, or date string.
* @param {Intl.DateTimeFormatOptions} [options] - Optional configuration for date formatting.
* - Defaults to { day: "2-digit", month: "2-digit", year: "numeric" }.
* @param {string} [format="YYYY-MM-DD"] - The desired output format.
* - Supported formats: 'YYYY-MM-DD', 'DD MMM YYYY', 'MMM DD YYYY'.
* @param {boolean} [unix=false] - If true, treats the numeric input as a Unix timestamp.
*
* @returns {string} A formatted date string according to the specified format.
*
* @throws {Error} If the date input is invalid.
*
* @example
* // Returns date in 'YYYY-MM-DD' format
* getFormattedDateString(new Date('2023-05-15'));
Expand Down Expand Up @@ -117,13 +118,12 @@ export const getFormattedDateString = (
/**
* Converts and formats a given date input into a time string in 'HH:mm:ss GMT' format without usage of external libraries such as moment.js or date-fns.
*
* @param {Date | number | string} dateInput - The date to be formatted. Can be a Date object, Unix timestamp, or date string.
* @param {Date | number | string} dateInput - The date to be formatted.
* - Can be a Date object, Unix timestamp, or date string.
* @param {boolean} [unix=false] - If true, treats the numeric input as a Unix timestamp.
*
* @returns {string} A formatted time string in 'HH:mm:ss GMT' format.
*
* @throws {Error} If the date input is invalid.
*
* @example
* getFormattedTimeString(new Date('2023-05-15T14:30:00Z'));
* // => "14:30:00 GMT"
Expand Down
14 changes: 2 additions & 12 deletions utils-docs/docs/Utils/format.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ Converts and formats a given date input into a specified string format. To be us

A formatted date string according to the specified format.

### Throws:

Throws an error if the date input is invalid.

### Examples:

```js
Expand Down Expand Up @@ -92,10 +88,6 @@ Converts and formats a given date input into a time string in the `'HH:mm:ss GMT

A formatted time string in the `'HH:mm:ss GMT'` format.

### Throws:

Throws an error if the date input is invalid.

### Examples:

```js
Expand Down Expand Up @@ -132,9 +124,6 @@ getAdjustedDate(5, "days", "add");

// Returns a Date object 2 years in the past
getAdjustedDate(2, "years", "subtract");

// Returns a Date object 10 days in the past
getAdjustedDate(10, "days", "subtract");
```

---
Expand All @@ -158,7 +147,8 @@ An object containing:
### Example:

```js
const longcode = "address: abc123def456ghi789jkl012mno345pqr678stu9, transaction: xyz123abc456def789ghi012jkl345mno678pqr901";
const longcode =
"address: abc123def456ghi789jkl012mno345pqr678stu9, transaction: xyz123abc456def789ghi012jkl345mno678pqr901";
const parsed = parseCryptoLongcode(longcode);

console.log(parsed.addressHash); // "abc123def456ghi789jkl012mno345pqr678stu9"
Expand Down

0 comments on commit 47fd41c

Please sign in to comment.