PHPackages                             mhzarei/jalali-date-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mhzarei/jalali-date-bundle

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

mhzarei/jalali-date-bundle
==========================

A symfony 3 bundle to handle Jalali date including a date picker

0.2.1(4y ago)06MITJavaScriptPHP ^5.5.9 || ^7.0

Since Aug 21Pushed 4y agoCompare

[ Source](https://github.com/MHZarei/NarmafzamJalaliDateBundle)[ Packagist](https://packagist.org/packages/mhzarei/jalali-date-bundle)[ RSS](/packages/mhzarei-jalali-date-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (14)Used By (0)

---

README
======

[](#readme)

**A symfony 3 bundle to handle Jalali date including a date picker**

[](#user-content-install)Install
--------------------------------

[](#install)

- **Install via Composer:**

```
    $ php composer require narmafzam/jalali-date-bundle

```

- **Add to AppKernel:**

```
class AppKernel extends Kernel
{
 public function registerBundles()
 {
 $bundles \= array(
 new Narmafzam\\JalaliDateBundle\\NarmafzamJalaliDateBundle(),
 }
}

```

- **install assets:**

```
    $ php app/console assets:install

```

[](#user-content-service)Service
--------------------------------

[](#service)

**Service Name:** narmafzam.j\_date\_service

**Functions:**

- **georgianToPersian:**
    Convert Georgian calendar (DateTime) To Persian (String).
    ***Parameters:***
    - georgian: DateTime (default: `null`)
    - format: string (default: `yyyy/MM/dd`) [View Intl Format](http://userguide.icu-project.org/formatparse/datetime)
    - locale: string (default: `fa`) (e.g. fa, fa\_IR, en, en\_US, en\_UK, ...)
    - calendar: string (default: `persian`) (e.g. gregorian, persian, islamic, ...)
    - latinizeDigit: bool (default: `false`) Convert Persian numbers to Latin Numbers.
- **persianToGeorgian:**
    Convert Persian calendar (String) To Georgian (DateTime).
    ***Parameters:***
    - persian: string
    - format: string (default: `yyyy/MM/dd`) [View Intl Format](http://userguide.icu-project.org/formatparse/datetime)
    - locale: string (default: `fa`) (e.g. fa, fa\_IR, en, en\_US, en\_UK, ...)
    - calendar: string (default: `persian`) (e.g. gregorian, persian, islamic, ...)
- **intlDateTimeInstance:**
    Return new Instance of IntlDateTime. [Visit Blog of Ali Farhadi](http://farhadi.ir/blog/1389/02/10/persian-calendar-for-php-53/)

**Sample:**

```
$shamsiString \= $this\->get('narmafzam.j\_date\_service')\->georgianToPersian(new \\DateTime(), 'yyyy-MM-dd E');
//result: ۱۳۹۴-۱۱-۲۲ دوشنبه
$shamsiString \= $this\->get('narmafzam.j\_date\_service')\->persianToGeorgian('1394-11-22 دوشنبه', 'yyyy-MM-dd E');
//result: An instance of DateTime

```

[](#user-content-twig)Twig
--------------------------

[](#twig)

**Functions:**

- **gpDate:**
    Convert Georgian calendar (DateTime) To Persian (String).
    ***Parameters:***
    - georgian: DateTime (default: `null`)
    - format: string (default: `yyyy/MM/dd`) [View Intl Format](http://userguide.icu-project.org/formatparse/datetime)
    - locale: string (default: `fa`) (e.g. fa, fa\_IR, en, en\_US, en\_UK, ...)
    - calendar: string (default: `persian`) (e.g. gregorian, persian, islamic, ...)
    - latinizeDigit: bool (default: `false`) Convert Persian numbers to Latin Numbers.
- **pgDate:**
    Convert Persian calendar (String) To Georgian (DateTime).
    ***Parameters:***
    - persian: string
    - format: string (default: `yyyy/MM/dd`) [View Intl Format](http://userguide.icu-project.org/formatparse/datetime)
    - locale: string (default: `fa`) (e.g. fa, fa\_IR, en, en\_US, en\_UK, ...)
    - calendar: string (default: `persian`) (e.g. gregorian, persian, islamic, ...)

**Sample:**

```
{{ date|gpDate }}
{{ date|gpDate('yyyy-MM-dd E') }}
{{ '1394/11/22'|gpDate }}
{{ '1394-11-22 دوشنبه'|gpDate('yyyy-MM-dd E') }}

```

[](#user-content-form)Form
--------------------------

[](#form)

**Type Name:** NarmafzamDateType

**Parameters:**

- serverFormat: string (default: `yyyy/MM/dd`) [View Intl Format](http://userguide.icu-project.org/formatparse/datetime)
- clientFormat: string (default: `yy/m/d`) [View DatePicker Format](https://api.jqueryui.com/datepicker/#utility-formatDate)
- attr: array
    You can add other DatePicker options to this param, but must change uppercase letters to lower and add dash before it. (see Samples)

***note:*** Result of serverFormat and clientFormat, must be the same.

**Sample:**

```
$builder
 \->add('date', NarmafzamJalaliDateType::class, \[
 'serverFormat' \=> 'yyyy/MM/dd',
 'pickerOptions' \=> \[
 'Format' \=> 'yyyy/MM/dd',
 'EnableTimePicker' \=> true,
 'GroupId' \=> 'group1',
 'FromDate' \=> true,
 'DisableBeforeToday' \=> true,
 \]
 \])
 \->add('date2', NarmafzamJalaliDateType::class, \[
 'serverFormat' \=> 'yyyy-MM-dd E',
 'pickerOptions' \=> \[
 'Format' \=> 'yyyy/MM/dd',
 'EnableTimePicker' \=> true,
 'GroupId' \=> 'group1',
 'ToDate' \=> true,
 \]
 \])

```

[](#user-content-date-picker)Date Picker
----------------------------------------

[](#date-picker)

**Requirements:**

- Bootstrap
- Jquery

**Add this lines to head tag in `base.html.twig` file:**

```

    ...

    ...

```

**Add this lines to end of body tag in `base.html.twig` file:**

```

```

**Add this lines to `app/config.yml` file:**

```
twig:
    form\_themes:
        - 'NarmafzamJalaliDateBundle:Form:form\_s\_date.html.twig'

```

**References:**

- [View Intl Format](http://userguide.icu-project.org/formatparse/datetime)
- [Class Intldateformatter](https://php.net/manual/en/class.intldateformatter.php)
- [MD.BootstrapPersianDateTimePicker](https://github.com/Mds92/MD.BootstrapPersianDateTimePicker)

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 71.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~109 days

Recently: every ~298 days

Total

12

Last Release

1614d ago

Major Versions

0.2.1 → 5.4.x-dev2021-12-10

### Community

Maintainers

![](https://www.gravatar.com/avatar/cd6cfcd29b8356532db808b5128d92e1b95458b7df372e59e3fcb3aa2a97b6c6?d=identicon)[mhzarei](/maintainers/mhzarei)

---

Top Contributors

[![Farshadi73](https://avatars.githubusercontent.com/u/30201402?v=4)](https://github.com/Farshadi73 "Farshadi73 (5 commits)")[![MHZarei](https://avatars.githubusercontent.com/u/3741390?v=4)](https://github.com/MHZarei "MHZarei (2 commits)")

---

Tags

Symfony jalali shamsi khorshidi persian date picker bundle

### Embed Badge

![Health badge](/badges/mhzarei-jalali-date-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/mhzarei-jalali-date-bundle/health.svg)](https://phpackages.com/packages/mhzarei-jalali-date-bundle)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
