monaz / symfonyjdate
Jalali (Shamsi) DateTime for Symfony2, Supports year higher than 2038
Installs: 12
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 0
Forks: 62
Type:symfony-bundle
Requires
- php: >=5.2.0
This package is auto-updated.
Last update: 2024-10-29 06:36:31 UTC
README
My changes on the original library to make it compatible with symfony 3x.
Symfony Bundle for converting dates from Gregorian calendar system to Jalali calendar system and vice versa. Supports dates beyond 2038.
Jalali, also known as Shamsi or Hijri Shamsi is the Iranian calendar system. It uses Salar Kaboli's jDateTime class for the conversion.
#Requirements
jDateTime Requires PHP >= 5.2
#Installation
composer require symfony_persia/symfonyjdate
And then add the package to app/AppKernel.php
#Examples
There is two ways to use this bundle:
##1. As a Twig filter (recommended)
Simply you can filter any variable containing a date, datetime, interval or date string:
{{ entity.date|jdate }}
Also it's possible to chose the format:
{{ entity.date|jdate('Y-m-d') }}
##2. As a service
Not recommanded, Maybe neccessary in some situations though.
Example:
$jDate = $serviceContainer->get('symfony_persia.jdate');
#Contributors:
##License Symfony JalaliDate Bundle was created by MohammadHossein Heydari and released under the MIT License.
Copyright (C) 2015 MohammadHossein Heydari
jDateTime was created by Sallar Kaboli and released under the MIT License.
Copyright (C) 2015 Sallar Kaboli
Part of Phoenix Framework (p5x.org) by Phoenix Alternatvie
Original Jalali to Gregorian (and vice versa) convertor:
Copyright (C) 2000 Roozbeh Pournader and Mohammad Toossi
The MIT License (MIT)
Copyright (C) 2015 MohammadHossein Heydari
Copyright (C) 2003-2015 Sallar Kaboli
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
1- The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
2- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
#Resources