diff --git a/docs/_sidebar.md b/docs/_sidebar.md index 10e2a5f..4d648a1 100644 --- a/docs/_sidebar.md +++ b/docs/_sidebar.md @@ -1,11 +1,18 @@ -
+
Welcome - [Introduction](./home.md) - [Installation](./guide/installation.md) +
-
+
How to Use +- [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) +
diff --git a/docs/guide/calculateDuration.md b/docs/guide/calculateDuration.md new file mode 100644 index 0000000..6a06453 --- /dev/null +++ b/docs/guide/calculateDuration.md @@ -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. diff --git a/docs/guide/convertTimeZone.md b/docs/guide/convertTimeZone.md new file mode 100644 index 0000000..4024e1b --- /dev/null +++ b/docs/guide/convertTimeZone.md @@ -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. diff --git a/docs/guide/formatDateInTimeZone.md b/docs/guide/formatDateInTimeZone.md new file mode 100644 index 0000000..2cb51a6 --- /dev/null +++ b/docs/guide/formatDateInTimeZone.md @@ -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. diff --git a/docs/guide/getCurrentTimeInZone.md b/docs/guide/getCurrentTimeInZone.md new file mode 100644 index 0000000..e318546 --- /dev/null +++ b/docs/guide/getCurrentTimeInZone.md @@ -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. diff --git a/docs/guide/getTimeZoneOffsetDifference.md b/docs/guide/getTimeZoneOffsetDifference.md new file mode 100644 index 0000000..5853793 --- /dev/null +++ b/docs/guide/getTimeZoneOffsetDifference.md @@ -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. diff --git a/docs/guide/installation.md b/docs/guide/installation.md index 0830491..d831e89 100644 --- a/docs/guide/installation.md +++ b/docs/guide/installation.md @@ -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 ``` diff --git a/docs/index.html b/docs/index.html index 6477913..c54fa19 100644 --- a/docs/index.html +++ b/docs/index.html @@ -52,7 +52,7 @@ - +