Quick answer: Saudi Arabia's official Hijri calendar is Umm al-Qura. In JavaScript use Intl.DateTimeFormat with the calendar islamic-umalqura; in .NET use UmAlQuraCalendar; in PHP use IntlDateFormatter with @calendar=islamic-umalqura. Avoid the generic "islamic" or "islamic-civil" calendars for Saudi systems – they can differ by one or two days.

Iqama expiry, government deadlines, Ramadan schedules and many Saudi contracts use Hijri dates. If your software shows the wrong Hijri day, users lose trust instantly. This guide shows the correct way to convert and display Hijri dates in the most common stacks.

Know your Islamic calendars

Calendar

How it works

Use it for

Umm al-Qura

Official Saudi calendar based on astronomical calculation for Makkah

Saudi government, Absher/Iqama-style dates, official documents

Tabular / civil (islamic-civil)

Fixed arithmetic pattern of 29/30-day months

Historical approximations

Moon sighting

Month starts when the crescent is seen

Religious occasions (Ramadan, Eid) – announced, not calculated

Important: Ramadan and Eid in Saudi Arabia are confirmed by the Supreme Court's moon-sighting announcement, which can differ from the pre-calculated Umm al-Qura date by a day. Show calculated dates as "expected" for religious events.

JavaScript / TypeScript

const date = new Date();
// English
new Intl.DateTimeFormat('en-u-ca-islamic-umalqura', {
  day: 'numeric', month: 'long', year: 'numeric'
}).format(date);                 // e.g. "Jumada II 20, 1448 AH"

// Arabic, full
new Intl.DateTimeFormat('ar-SA-u-ca-islamic-umalqura', { dateStyle: 'full' })
  .format(date);                 // e.g. "الاثنين، ٢٠ جمادى الآخرة ١٤٤٨ هـ"

// Get numeric parts (Latin digits)
const parts = Object.fromEntries(
  new Intl.DateTimeFormat('en-u-ca-islamic-umalqura-nu-latn', {
    day: 'numeric', month: 'numeric', year: 'numeric'
  }).formatToParts(date).map(p => [p.type, p.value])
);
// parts.day, parts.month, parts.year

Hijri → Gregorian in JavaScript

Intl only formats; it cannot parse a Hijri date. A simple, reliable approach is to search nearby Gregorian days:

function hijriToGregorian(hy, hm, hd) {
  const fmt = new Intl.DateTimeFormat('en-u-ca-islamic-umalqura-nu-latn',
    { day: 'numeric', month: 'numeric', year: 'numeric' });
  const read = d => Object.fromEntries(fmt.formatToParts(d).map(p => [p.type, +p.value || p.value]));
  // rough estimate: Hijri year ≈ 354.367 days
  let guess = new Date(Date.UTC(622, 6, 16) + ((hy - 1) * 354.367 + (hm - 1) * 29.53 + hd) * 864e5);
  for (let i = -40; i <= 40; i++) {
    const d = new Date(guess.getTime() + i * 864e5);
    const p = read(d);
    if (p.year === hy && p.month === hm && p.day === hd) return d;
  }
  return null;
}

C# / .NET

using System.Globalization;

var cal = new UmAlQuraCalendar();
DateTime today = DateTime.Today;
int hy = cal.GetYear(today), hm = cal.GetMonth(today), hd = cal.GetDayOfMonth(today);

// Hijri -> Gregorian
DateTime g = new DateTime(1448, 9, 1, cal);   // 1 Ramadan 1448

// Formatting in Arabic with Umm al-Qura
var culture = new CultureInfo("ar-SA");
culture.DateTimeFormat.Calendar = cal;
string s = today.ToString("dd MMMM yyyy", culture);

Note: UmAlQuraCalendar supports dates roughly from 1900 to 2077 (1318–1500 AH). Validate input outside that range.

PHP / Laravel

$fmt = new IntlDateFormatter(
    'ar_SA@calendar=islamic-umalqura',
    IntlDateFormatter::FULL,
    IntlDateFormatter::NONE,
    'Asia/Riyadh',
    IntlDateFormatter::TRADITIONAL
);
echo $fmt->format(new DateTime());

// Hijri string -> timestamp
$fmt->setPattern('d/M/y');
$ts = $fmt->parse('1/9/1448');

Requires the intl extension. In Laravel, wrap this in a helper or a Carbon macro.

Python

Use a maintained Umm al-Qura library such as hijridate (formerly hijri-converter):

from hijridate import Hijri, Gregorian
Gregorian(2026, 11, 30).to_hijri()     # Hijri(1448, 6, 20)
Hijri(1448, 9, 1).to_gregorian()

Database and API design tips

  • Store Gregorian (or UTC timestamps) in the database; convert to Hijri only for display. This avoids calendar bugs in sorting and arithmetic.
  • If users enter Hijri dates (for example an Iqama expiry), store both the original Hijri input and the converted Gregorian date.
  • Return both in APIs: {"gregorian": "...", "hijri": {"y": 1448, "m": 9, "d": 1}}.
  • Always set the time zone (Asia/Riyadh) – a date near midnight UTC can shift the day.
  • Write unit tests against official Umm al-Qura tables for month starts.

Hijri month names

1 Muharram, 2 Safar, 3 Rabi' al-Awwal, 4 Rabi' al-Thani, 5 Jumada al-Ula, 6 Jumada al-Akhirah, 7 Rajab, 8 Sha'ban, 9 Ramadan, 10 Shawwal, 11 Dhu al-Qa'dah, 12 Dhu al-Hijjah.

Summary

  • Use Umm al-Qura for Saudi systems.
  • JS: islamic-umalqura; .NET: UmAlQuraCalendar; PHP: @calendar=islamic-umalqura.
  • Store Gregorian/UTC, display Hijri.
  • Label Ramadan and Eid as "expected" until officially announced.