Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

dayjs-hijri

mashhadiebad214MIT1.0.1

A Hijri calendar (Based on Umm al-Qura calculations) plugin for day.js.

hijri, hijriah, arabic, lunar, Umm al-Qura, date, calendar, conversion, convert, day.js, dayjs, plugin, moment, dayjs-hijri, plugin, gregorian

readme

Day.js Hijri Plugin

A lightweight Day.js plugin for Hijri calendar conversion and formatting.

npm Downloads Build Status codecov

This plugin adds Hijri calendar (Based on Umm al-Qura calculations) support to Day.js, enabling developers to seamlessly convert and manipulate Hijri dates while leveraging Day.js's lightweight API.

Installation

NPM

npm install --save dayjs-hijri

YARN

yarn add dayjs-hijri

Usage

import dayjs from 'dayjs'
import dayjsHijri from 'dayjs-hijri'

dayjs.extend(dayjsHijri)

Parse Date

  • Parse Gregory date
    const date = dayjs('2025-01-07T16:00:00.000Z');
  • Parse hijri date that only gives you a dayjs object that has only Gregory date
    const date = dayjs('1446-10-17', { hijri: true });

Changing calendar

If you want to all new instanses of dayjs use hijri calendar, you can set default calendar

dayjs.calendar('hijri') // hijri Calendar
// OR
dayjs.calendar('gregory') // Gregorian Calendar

also you can create a hijri date without changing default calendar

const date = dayjs()
const hijriDate = date.calendar('hijri')

Multiple Locale

with combination of calendar and locale we have multi language for real

dayjs('2025-01-07').calendar('hijri').locale('en').format('DD MMMM YYYY') // '07 Rajab 1446'
dayjs('1446-07-07').calendar('gregory').locale('ar').format('DD MMMM YYYY') // '07 ینایر 2025'

Live Demo

Try the plugin live on CodeSandbox: Open Demo.

License

MIT © 2025 M25D

changelog

Changelog

v1.0.1 - 2025-01-22

  • Fix .npmignore

v1.0.0 - 2025-01-22

  • Initial release