npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

arabic-datetime-converter

v1.0.2

Published

Convert English dates/times to Arabic with Arabic numerals.

Readme

arabic-datetime-converter

Convert English dates/times to Arabic with Eastern Arabic numerals (٠–٩). Zero runtime dependencies. ESM + CJS. Fully typed.

Features

  • Date conversion: March 22, 2025٢٢ مارس ٢٠٢٥
  • Time conversion: 5:45 PM٥:٤٥ م (AM → ص, PM → م)
  • DateTime conversion: ٢٢ مارس ٢٠٢٥ - ٥:٤٥ م
  • Digits only: Replace 0–9 with ٠–٩ in any string
  • Tree-shakeable, TypeScript types, ESM + CJS

Install

npm i arabic-datetime-converter
# or
pnpm add arabic-datetime-converter
# or
yarn add arabic-datetime-converter

Quick Start

ESM

import {
  convertDateToArabic,
  convertTimeToArabic,
  convertDateTimeToArabic,
  toArabicNumbers,
} from "arabic-datetime-converter";

convertDateToArabic(new Date("2025-03-22")); // "٢٢ مارس ٢٠٢٥"
convertTimeToArabic("5:45 PM"); // "٥:٤٥ م"
convertDateTimeToArabic("November 5, 2025 11:30 AM"); // "٥ نوفمبر ٢٠٢٥ - ١١:٣٠ ص"
toArabicNumbers("Order #12345 on 2025-03-22"); // "Order #١٢٣٤٥ on ٢٠٢٥-٠٣-٢٢"

CommonJS

const {
  convertDateToArabic,
  convertTimeToArabic,
  convertDateTimeToArabic,
  toArabicNumbers,
} = require("arabic-datetime-converter");

API

  • toArabicNumbers(input: string | number): string

    • Replaces Western digits 0–9 with Eastern Arabic digits ٠–٩.
  • convertDateToArabic(input: Date | string | number): string

    • Accepts a Date, ISO string, or timestamp. Returns Arabic day, month (Arabic name), year with Arabic digits.
  • convertTimeToArabic(input: Date | string | number): string

    • Accepts a Date or time string like "5:45 PM" or "11:30 AM". Returns Arabic digits and meridiem (ص/م).
  • convertDateTimeToArabic(input: Date | string | number): string

    • Returns "<date> - <time>" in Arabic.

Notes

  • Month names mapping: يناير, فبراير, مارس, أبريل, مايو, يونيو, يوليو, أغسطس, سبتمبر, أكتوبر, نوفمبر, ديسمبر
  • Meridiem: AM → ص, PM → م

Compatibility

  • Works in Node and modern bundlers/frameworks (React, Vue, Angular, Svelte, Next.js, Nuxt, etc.)
  • ESM import and CommonJS require both supported
  • Types included (.d.ts) for TypeScript users

Examples

Format today’s date and current time

import {
  convertDateToArabic,
  convertTimeToArabic,
} from "arabic-datetime-converter";

convertDateToArabic(new Date()); // e.g. "٥ نوفمبر ٢٠٢٥"
convertTimeToArabic(new Date()); // e.g. "١١:٣٠ ص"

Convert a mixed string’s digits

import { toArabicNumbers } from "arabic-datetime-converter";

toArabicNumbers("2025/11/05 14:07"); // "٢٠٢٥/١١/٠٥ ١٤:٠٧"

License

MIT