Keyword

Dates not displaying correctly after update to Joomla 3.8.13 and K2 2.9.

  • Andrew Paterson
  • Andrew Paterson's Avatar Topic Author
  • Offline
  • Junior Member
More
2 months 5 days ago #169628 by Andrew Paterson
Andrew Paterson created the topic: Dates not displaying correctly after update to Joomla 3.8.13 and K2 2.9.
After updating Joomla to 3.8.13, the dates in all K2 content modules, K2 category items and K2 items are not being formatted correctly.

K2 version is and K2 2.9.

They look like this: %AM, %14 %315 %2018. where they have been working fine before.

This is the template code I'm using for mod_content for example:
<?php if($params->get('itemDateCreated')): ?>
        <span class="moduleItemDateCreated"> <?php echo JHTML::_('date', $item->created, JText::_('K2_DATE_FORMAT_LC')); ?></span>
      <?php endif; ?>

This is in my current en-GB.com_k2.ini file:
K2_DATE_FORMAT="%d/%m/%Y - %H:%M"
K2_DATE_FORMAT_LC2="%A, %d %B %Y %H:%M"
K2_DATE_FORMAT_LC="%A, %d %B %Y"

The problem occurs whent he PHP version is either 5.6 or 7.0.

Please Log in or Create an account to join the conversation.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
2 months 4 days ago #169643 by Fotis
Fotis replied the topic: Dates not displaying correctly after update to Joomla 3.8.13 and K2 2.9.
mod_k2_content loads its own language file from /language/en-GB/en-GB.mod_k2_content.ini - make sure nothing else is overriding K2's language strings for date definitions (it could be an override placed in the Joomla backend for example).


If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

Please Log in or Create an account to join the conversation.

  • Andrew Paterson
  • Andrew Paterson's Avatar Topic Author
  • Offline
  • Junior Member
More
2 months 3 days ago #169677 by Andrew Paterson
Andrew Paterson replied the topic: Dates not displaying correctly after update to Joomla 3.8.13 and K2 2.9.
Thank you.

The formatting issue is happening with all K2 templates- category list items, full items and items in the K2 content module. I tried pasting the date format string directly into the template as below.
<span class="catItemDateCreated"> <?php echo JHTML::_('date', $this->item->publish_up , "%A, %d %B %Y %H:%M"); ?> </span>

The date looks like this on the frontend:

%AM, %26 %343 %2016 %09:%Sep

I tried with the default K2 date format:
<span class="catItemDateCreated"> <?php echo JHTML::_('date', $this->item->publish_up , "%d/%m/%Y - %H:%M"); ?> </span>

The date appears like this:

%26/%09/%2016 - %09:%Sep

If I remove the date format altogether, I get what I assume is the default Joomla date format.
<span class="catItemDateCreated"> <?php echo JHTML::_('date', $this->item->publish_up); ?> </span>

Monday, 26 September 2016

Do you think the above could still be caused by an override of a K2 language file?

Please Log in or Create an account to join the conversation.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
2 months 3 days ago #169686 by Fotis
Fotis replied the topic: Dates not displaying correctly after update to Joomla 3.8.13 and K2 2.9.
I literally have no idea. It's the first time anyone reports something like that. It could be a broken override or even a system plugin.


If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

Please Log in or Create an account to join the conversation.

More
1 month 3 weeks ago #169790 by Florian
Florian replied the topic: Dates not displaying correctly after update to Joomla 3.8.13 and K2 2.9.
Hi All,
Just to mention I'm facing the same issue. It occurs on frontend but not on backend where I can see date displaying correctly.
Joomla 3.8.13 / PHP 7.2

Please Log in or Create an account to join the conversation.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
1 month 3 weeks ago #169796 by Fotis
Fotis replied the topic: Dates not displaying correctly after update to Joomla 3.8.13 and K2 2.9.
@Andrew
Change the code to:
<span class="catItemDateCreated">
    <?php echo JHTML::_('date', $this->item->publish_up , "d/m/Y - H:i"); ?>
</span>

In other words don't use % and refer to php.net/manual/en/function.date.php for date formatting.

@Florian
Can you try the above solution as well and let me know if it works please?


If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

Please Log in or Create an account to join the conversation.

More
1 month 3 weeks ago - 1 month 3 weeks ago #169805 by Florian
Florian replied the topic: Dates not displaying correctly after update to Joomla 3.8.13 and K2 2.9.
Hi Fotis,

Thanks for your support. I've made the change and it is working fine.
For your information, the original code was :
<span class="itemDateCreated"> <?php echo JHTML::_('date', $this->item->created, JText::_('K2_DATE_FORMAT_LC2')); ?>

Any clue why it stops displaying correctly ?

Update: i'm using french language file (fr-FR.com_k2.ini version 2.7.x) and variable K2_DATE_FORMAT_LC2 has value "%A, %d %B %Y %H:%M".
Last Edit: 1 month 3 weeks ago by Florian. Reason: add details

Please Log in or Create an account to join the conversation.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
1 month 3 weeks ago #169814 by Fotis
Fotis replied the topic: Dates not displaying correctly after update to Joomla 3.8.13 and K2 2.9.
I couldn't replicate the issue. Did you also check that there is no direct override from the language overrides section in Joomla's backend?

Out of curiosity, what PHP version are you using?


If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

Please Log in or Create an account to join the conversation.

  • Andrew Paterson
  • Andrew Paterson's Avatar Topic Author
  • Offline
  • Junior Member
More
1 month 3 weeks ago #169817 by Andrew Paterson
Andrew Paterson replied the topic: Dates not displaying correctly after update to Joomla 3.8.13 and K2 2.9.
Thank you, this works for me.
I really appreciate your help.

Please Log in or Create an account to join the conversation.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
1 month 3 weeks ago #169818 by Fotis
Fotis replied the topic: Dates not displaying correctly after update to Joomla 3.8.13 and K2 2.9.
Good to know Andrew.


If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

Please Log in or Create an account to join the conversation.

Moderators: william white