-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: format date based on local and timezone (#22)
- Loading branch information
1 parent
e158104
commit c5b26c0
Showing
4 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Format Date based on the given locale and timezone. | ||
|
||
## Description | ||
|
||
This feature allows you to format a date string based on the given locale and timezone. | ||
|
||
## Usage | ||
|
||
```javascript | ||
import { formatDateForLocale } from 'world-clockify'; | ||
|
||
const formattedDateFR = formatDateForLocale('2024-10-17T10:30:00', 'fr', 'Europe/Paris'); | ||
const formattedDateUS = formatDateForLocale('2024-10-17T10:30:00', 'en-US', 'America/New_York'); | ||
|
||
console.log('Formatted Date (FR):', formattedDateFR); | ||
console.log('Formatted Date (US):', formattedDateUS); | ||
``` | ||
|
||
## Expected Output | ||
|
||
```bash | ||
Formatted Date (FR): jeudi 17 octobre 2024 à 12:30:00 heure d’Europe centrale | ||
Formatted Date (US): Thursday, October 17, 2024, 06:30:00 AM Eastern Daylight Time | ||
|
||
``` | ||
|
||
## Parameters | ||
|
||
- dateStr (string): The date string in ISO format. | ||
- local (string): The target local (e.g., 'fr', 'en-US'). | ||
- timezone (string): The format to use for the output date string. | ||
|
||
## Returns | ||
|
||
- (string): The formatted string in the target local. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters