JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 33
  • Score
    100M100P100Q50108F
  • License MIT

A simple utility to convert any date or time to Iran's local time with Persian date formatting.

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (persiantime) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    PersianTime Library

    A simple utility to convert any date or time to Irans's local time with Persian date formatting.

    Example Image

    Installation

    Install the library using npm:

    npm install persiantime

    or using Yarn:

    yarn add persiantime

    Usage

    Import the persiantime function into your project and use it to convert numbers or strings containing numbers into Persian format.

    Example

    import { PersianTime } from 'persiantime';
    
    const isoDate = "2025-01-17T03:10:54.225000+03:30";
    PersianTime(isoDate)
    

    Function Signature

    export function PersianTime(time: string | Date | number): string;

    Parameters:

    ▪ time: Can be a string (ISO 8601 format), Date object, or timestamp (number).

    Returns:

    ▪ A string representing the date and time in Persian format with Iran's local time.

    Features

    Persian Date: Converts the date to the Persian calendar.
    Iran Timezone: Adjusts the time to Iran's local timezone (UTC +03:30).
    Handles Invalid Dates: Returns an error message if the provided date is invalid.

    License

    MIT License