Have ideas to improve npm?Join in the discussion! »

jalaliday-forked

2.3.6 • Public • Published

Jalaliday-forked

This is a fork of the Jalaliday plugin for the awesome Day.js.

This package should be considered a temporary solution until some fixes are applied to the original project. I just need this package in the meanwhile :D

Please note that this package will be deprecated whenever the main package fixes the issues that are fixed here. So keep an eye out.

The rest of this page is the original README in the time of fork.

Jalaliday

npm (scoped with tag) npm CircleCI Codecov Dependencies js-standard-style

Persian (Jalali, Khorshidi) Plugin for Day.js, Jalaliday 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

📖 Release Notes

Installation

NPM

npm install --save jalaliday

YARN

yarn add jalaliday

Usage

import dayjs from 'dayjs'
import jalaliday from 'jalaliday'
 
dayjs.extend(jalaliday)

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')

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'

API

All Api operations of Jalaliday is same as Dayjs itself but calendar based, for more information checkout Dayjs API For a glance:

Install

npm i jalaliday-forked

DownloadsWeekly Downloads

1

Version

2.3.6

License

MIT

Unpacked Size

113 kB

Total Files

20

Last publish

Collaborators

  • avatar