mtm/persian-date-bundle

There is no license information available for the latest version (v1.0.4) of this package.

v1.0.4 2015-10-28 19:37 UTC

This package is not auto-updated.

Last update: 2024-05-11 17:17:41 UTC


README

Symfony2 PersianDateBundle

Installation:

composer require mtm/persian-date-bundle:1.0.4

add following line to your AppKernel.php

new Mtm\PersianDateBundle\MtmPersianDateBundle(),

Usage:

Form Type:

This bundle comes with a mtm_persian_date_type form type which prompt user for persian date at view layer and converts it to Standard PHP DateTime object at business layer. So you can use Standard PHP DateTime object as form data.

Here is how to use it:

$dateTime = new \DateTime('tomorrow');

$this->createForm('mtm_persian_date_type', $dateTime);

Twig Filter:

This bundle also adds a very handy twig filter persian_date to format Standard PHP DateTime object.

<td>
    {{ post.createdAt| persian_date("Y-m-d') }}
</td>