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

Wrong Date Convert on Adding Item in Farsi (Persian) Language #247

Closed
majidmahdavi opened this issue Jul 31, 2015 · 3 comments
Closed

Wrong Date Convert on Adding Item in Farsi (Persian) Language #247

majidmahdavi opened this issue Jul 31, 2015 · 3 comments

Comments

@majidmahdavi
Copy link

on Adding new Item (When no date chosen yet), date printed in HTML source in Jalali format , so the datetime picker try to convert it again to Jalali and result will be so wrong date.

the only thing that working right, is on submitting form ( when i choose correct date by picker) and save the form, before saving, date converted to Georgian, but again when form loaded, it has printed Jalali date in HTML and again like new state

summary:
everything is fine when submitting form
but when form loaded ( adding new item, or editing item directly from database) it shows jalali date in HTML which is wrong approach

solve proposal:
Date have to be printed in Georgian in Date input HTML and have to be converted to jalali in run time by java-script (which just working fine only submit event, not load)

my question:
how to stop k2 to not convert date in jalali in HTML Source?

@majidmahdavi
Copy link
Author

After investigating k2 source codes, i figured it up how to fix that!

i just commented this lines:
started at line number 137 from view.html.php at administrator\components\com_k2\views\item

    //$created = JHTML::_('date', $item->created, $dateFormat);
    //$publishUp = JHTML::_('date', $item->publish_up, $dateFormat);
    if ((int)$item->publish_down)
    {
        //$publishDown = $item->publish_down;JHTML::_('date', $item->publish_down, $dateFormat);
    }
    else
    {
        $publishDown = '';
    }

@majidmahdavi
Copy link
Author

it seems JHTML:: convert date to admin user logged-in language and thats cause the problem,
i like to hear the main reason of that by author, please bright me up

@majidmahdavi
Copy link
Author

i compared k2 item to Joomla Content Article source code, and understood that content article wont convert date, just simply using JFactory::getDate()->toSql();

but in k2 after that using JHTML::

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant