Skip to content

Commit

Permalink
docs: Add detailed guides for key features and improve installation i…
Browse files Browse the repository at this point in the history
…nstructions
  • Loading branch information
shivam-sharma7 committed Oct 15, 2024
1 parent df71f2b commit cf23f82
Show file tree
Hide file tree
Showing 8 changed files with 166 additions and 4 deletions.
11 changes: 9 additions & 2 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
<details open style="margin-left: 33px">
<details open>
<summary>Welcome</summary>

- [Introduction](./home.md)
- [Installation](./guide/installation.md)

</details>

<details open style="margin-left: 33px">
<details open style="margin-left: 20px">
<summary>How to Use</summary>

- [Get Current Time in Zone](./guide/getCurrentTimeInZone.md)
- [Convert Time Zone](./guide/convertTimeZone.md)
- [Time Zone Offset Difference](./guide/getTimeZoneOffsetDifference.md)
- [Format Date in Time Zone](./guide/formatDateInTimeZone.md)
- [Calculate Duration](./guide/calculateDuration.md)

</details>
30 changes: 30 additions & 0 deletions docs/guide/calculateDuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Calculate Duration

## Description

This feature allows you to calculate the duration between two dates in a specified unit.

## Usage

```javascript
import { calculateDuration } from 'world-clockify';

const duration = calculateDuration('2023-10-01T12:00:00', '2023-10-02T12:00:00', 'hours');
console.log('Duration (in hours):', duration);
```

## Expected Output

```bash
Duration (in hours): 24
```

## Parameters

- startDate (string): The start date string in ISO format.
- endDate (string): The end date string in ISO format.
- unit (string): The unit to calculate the duration (hours, minutes, seconds, days, months, years).

## Returns

- (number): The duration between the two dates in the specified unit.
30 changes: 30 additions & 0 deletions docs/guide/convertTimeZone.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Convert Time Zone

## Description

This feature allows you to convert a date/time from one timezone to another.

## Usage

```javascript
import { convertTimeZone } from 'world-clockify';

const convertedTime = convertTimeZone('2023-10-01T12:00:00', 'America/New_York', 'Asia/Kolkata');
console.log('Converted Time:', convertedTime);
```

## Expected Output

```bash
Converted Time: 2023-10-01T21:30:00+05:30
```

## Parameters

- dateStr (string): The date string in ISO format.
- fromZone (string): The source timezone.
- toZone (string): The target timezone.

## Returns

- (string): The converted date/time in ISO format.
36 changes: 36 additions & 0 deletions docs/guide/formatDateInTimeZone.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Format Date in Time Zone

## Description

This feature allows you to format a date string for a given timezone in the specified format.

## Usage

```javascript
import { formatDateInTimeZone } from 'world-clockify';

const formattedDate = formatDateInTimeZone(
'2023-10-01T12:00:00',
'America/New_York',
'Asia/Kolkata',
'yyyy LLL dd HH:mm:ss',
);
console.log('Formatted Date:', formattedDate);
```

## Expected Output

```bash
Formatted Date: 2023 Oct 02 21:30:00
```

## Parameters

- dateStr (string): The date string in ISO format.
- fromZone (string): The source timezone.
- toZone (string): The target timezone.
- format (string): The format to use for the output date string.

## Returns

- (string): The formatted string in the target timezone.
30 changes: 30 additions & 0 deletions docs/guide/getCurrentTimeInZone.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Get Current Time in Zone

## Description

This feature allows you to get the current time in any specified timezone.

## Usage

```javascript
import { getCurrentTimeInZone } from 'world-clockify';

const currentTimeInKolkata = getCurrentTimeInZone('Asia/Kolkata');
console.log('Current Time in Kolkata:', currentTimeInKolkata);
```

## Expected Output

Note: The actual output will vary depending on the current time when the function is called

```bash
Current Time in Kolkata: 2023-10-01T21:30:00+05:30
```

## Parameters

- timezone (string): The timezone to get the current time.

## Returns

- (string): The current date/time in ISO format.
29 changes: 29 additions & 0 deletions docs/guide/getTimeZoneOffsetDifference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Get Time Zone Offset Difference

## Description

This feature allows you to calculate the time difference (in hours) between two timezones.

## Usage

```javascript
import { getTimeZoneOffsetDifference } from 'world-clockify';

const timeDifference = getTimeZoneOffsetDifference('America/New_York', 'Asia/Kolkata');
console.log('Time Difference (in hours):', timeDifference);
```

## Expected Output

```bash
Time Difference (in hours): 9.5
```

## Parameters

- timezone1 (string): The first timezone.
- timezone2 (string): The second timezone.

## Returns

- (number): The time difference (in hours) between the two timezones.
2 changes: 1 addition & 1 deletion docs/guide/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ First, you need to download node.js 20+ [Download Node.js](https://nodejs.org/en

Then You can install the package via npm or yarn.

```bash
```shell
npm install world-clockify
```

Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<script src="//polyfill.io/v3/polyfill.min.js?features=String.prototype.normalize"></script>

<script src="https://cdn.jsdelivr.net/npm/docsify-progress@latest/dist/progress.min.js"></script>

<script src="//unpkg.com/docsify-pagination/dist/docsify-pagination.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-bash.min.js"></script>
</body>
</html>

0 comments on commit cf23f82

Please sign in to comment.