Socket
Book a DemoInstallSign in
Socket

@zoomit/dayjs-jalali-plugin

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zoomit/dayjs-jalali-plugin

Persian (Jalali, Khorshidi) Plugin for Day.js

0.1.11
latest
Source
npmnpm
Version published
Weekly downloads
455
16.67%
Maintainers
2
Weekly downloads
 
Created
Source

Dayjs-Jalali-Plugin

npm (scoped with tag) npm

Persian (Jalali, Khorshidi) Plugin for Day.js, This package add multi-calendar functionality to Day.js core regardless for of locale, so we can have Gregorian calendar is Persian locale of Jalali calendar in English locale Unlike moment and becuase of immutablity of dayjs, there is no need for formats like jYYYY or jMM, in Jalaliday all formats are same and standard

Installation

NPM

npm install --save @zoomit/dayjs-jalali-plugin

YARN

yarn add @zoomit/dayjs-jalali-plugin

Usage

import dayjs from 'dayjs'
import jalaliPlugin from '@zoomit/dayjs-jalali-plugin'

dayjs.extend(jalaliPlugin)

Changing calendar

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

dayjs.calendar('jalali') // Jalali Calendar
// OR
dayjs.calendar('gregory') // Gregorian Calendar

also you can create a jalali date without changing default calendar

const date = dayjs()
const jalaliDate = date.calendar('jalali')

Parse Date

  • Parse Gregory date
const date = dayjs('2018-04-04T16:00:00.000Z');
  • Parse Jalali date
const date = dayjs('1398-10-17', { jalali: true });

Multiple Locale

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

dayjs().calendar('jalali').locale('en').format('DD MMMM YYYY') // '13 Shahrivar 1397'
dayjs().calendar('gregory').locale('fa').format('DD MMMM YYYY') // '04 سپتامبر 2018'

Keywords

dayjs

FAQs

Package last updated on 17 Mar 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.