Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR] show dates in other calendar format #5000

Open
vnali opened this issue Sep 26, 2019 · 2 comments

Comments

@vnali
Copy link
Contributor

commented Sep 26, 2019

Description

we use a different calendar type than Gregorian in Iran
https://en.wikipedia.org/wiki/Iranian_calendars
usually in custom twig templates we can use twig extension and we can convert Gregorian date to a Persian date with code like this:

$intl=new IntlDateFormatter('fa_IR@calendar=persian', IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'Asia/Tehran', IntlDateFormatter::TRADITIONAL, 'yyyy/MM/dd HH:mm');
$persian_date = $intl->format($date);

so we convert date like 2019/09/26 to Persian format like 1398/07/04

but in pages like http://craft.samplesite/admin/entries, we have Post Date and craft shows it in Gregorian format like 2019/09/26 and i think this is good to idea to show column date in Persian calendar system like 1398/07/04 - maybe if user language is set to Persian or maybe if there is a calendar type per user and it is set to Persian calendar-

possible solution:
it seems Yii2 support different calendar types:
yiisoft/yii2@cdb7d84
so i tried to add

'locale' => 'fa_IR@calendar=persian',
'calendar' => \IntlDateFormatter::TRADITIONAL, 

to https://github.com/craftcms/cms/blob/develop/src/config/locales/fa.php

but it seems craft ignores calendar type and generate date column in Gregorian anyway.

is it possible to show dates in other calendar format for columns like post date or expiry date?

@vnali vnali changed the title show dates in other calendar format [FR] show dates in other calendar format Oct 10, 2019
@vnali

This comment has been minimized.

Copy link
Contributor Author

commented Oct 10, 2019

i saw a commit about this by you @brandonkelly on yii2 repo. could we possibly have this in near future?

@brandonkelly

This comment has been minimized.

Copy link
Member

commented Oct 11, 2019

@vnali Yeah I’m working on it for 3.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.