PersianTime: Your Go-To JavaScript Library for Iranian Time and Date Formatting
This lightweight utility effortlessly converts any date or time to Iran's local time, displaying it in the familiar Persian date format. Ideal for applications targeting Iranian users or those needing seamless Persian calendar integration.
Key Features:
Installation:
Install via npm:
npm install persiantime
Or Yarn:
yarn add persiantime
Usage Examples:
Formatting a date:
import { PersianTime } from 'persiantime'; const persianDate = PersianTime(new Date('2025-01-20T11:05:20.451Z')); console.log(persianDate); // Output: Persian formatted date and time
Handling API dates (ISO format):
import { PersianTime } from 'persiantime'; const creationTime = PersianTime(new Date(document.created_at)); const updateTime = PersianTime(new Date(document.updated_at)); console.log(creationTime); console.log(updateTime);
Why Choose PersianTime?
Contributing:
We welcome contributions! Fork the repository, make your improvements, and submit pull requests. Report issues or suggest features on the GitHub repository.
Show Your Support:
Star the project on GitHub and leave a review on npm to help us continue development and add new features.
Links:
Thank you for using PersianTime!
The above is the detailed content of Convert Dates to Persian Time in React. For more information, please follow other related articles on the PHP Chinese website!