Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

JoomlaTune Support Forum    JComments component    Bug-reports    Topic: [solved] Timestamp on published comments showing as Y-m-d H:i
Pages: [1]   Go Down
  Print  
Author Topic: [solved] Timestamp on published comments showing as Y-m-d H:i  (Read 3152 times)
0 Members and 1 Guest are viewing this topic.
lukit
Newbie
*

Karma: 0
Offline Offline

Posts: 3


« on: June 07, 2012, 00:57:09 »

Hello,

I hope you can help me.

I'm not sure if there is some setting I'm missing but the timestamp on comments is showing as Y-m-d H:i rather than the actual date and time (please see http://www.twimii.com/recipes/vegetarian-recipes/simple-summer-quiche)

I just installed jcomments yesterdays. It took me a little bit of time to figure out how to change the look but so far it seems great. Just need to figure out how to fix this timestamp error.

Any help would be great  Huh

Thanks  Smiley
« Last Edit: July 02, 2012, 14:46:04 by smart » Logged
lukit
Newbie
*

Karma: 0
Offline Offline

Posts: 3


« Reply #1 on: June 07, 2012, 02:05:35 »

I think the problem is with this line in components/com_jcomments/tpl/default/tpl_comment.php

<span class="comment-date"><?php echo JCommentsText::formatDate($comment->datetime, JText::_('DATETIME_FORMAT')); ?></span>

The db field is date not datetime  for me but when I changed it to

 <span class="comment-date"><?php echo JCommentsText::formatDate($comment->date, JText::_('DATETIME_FORMAT')); ?></span>

this still didn't work

I'm using

<span class="comment-date"><?php echo $comment->date ?></span>

 as a workaround but I'd really like to figure out how to format this by linking to what's set in the language file format to. I think that's what the original line of code is doing but I can't get it to work.

I'm not clear on how joomla commands like JCommentsText::formatDate work - this looks fairly similar to a normal php date formatting function but... if anyone could let me know how it works that would be great.

Thanks in advance  Huh


Logged
smart
Administrator
Hero Member
*****

Karma: 163
Offline Offline

Gender: Male
Posts: 2161



WWW
« Reply #2 on: June 07, 2012, 14:43:50 »

You're right in database field is named as 'date', but in previous versions 'datetime' field has been used in templates so I've leaved 'datetime' for backward compatibility. Regarding datetime format you can change in in JComments' language file (/language/en-GB/en-GB.com_jcomments.ini):

Code: (ini)
DATE_FORMAT="Y-m-d"
TIME_FORMAT="H:i"
DATETIME_FORMAT="Y-m-d H:i"
Logged

If you use JComments, please post a rating and a review at the Joomla! Extensions Directory
lukit
Newbie
*

Karma: 0
Offline Offline

Posts: 3


« Reply #3 on: June 08, 2012, 16:57:45 »

Thanks for replying Smart  Smiley

I still can't get this line to work though

 <span class="comment-date"><?php echo JCommentsText::formatDate($comment->date, JText::_('DATETIME_FORMAT')); ?></span>

can you see anything wrong the syntax?

I'm happy enough with the workaround for now but I'd just love to know why that line won't work.

Thanks again  Smiley
Logged
smart
Administrator
Hero Member
*****

Karma: 163
Offline Offline

Gender: Male
Posts: 2161



WWW
« Reply #4 on: June 08, 2012, 17:27:44 »

Try to use $comment->datetime instead $comment->date... Default tempate displays date and time of comment without any issues.
Logged

If you use JComments, please post a rating and a review at the Joomla! Extensions Directory
zyberchief
Newbie
*

Karma: 0
Offline Offline

Posts: 2


« Reply #5 on: June 11, 2012, 14:26:27 »

I don't know if it is the same problem, but I got some wierd as date shown on my site:

http://www.brugtbogshoppen.dk/kob-og-salg

How do I get rid of the "%" Huh
Logged
smart
Administrator
Hero Member
*****

Karma: 163
Offline Offline

Gender: Male
Posts: 2161



WWW
« Reply #6 on: June 11, 2012, 14:32:39 »

@zyberchief: it looks like you've wrong datetime format in language file. Which language do you use?

p.s. seems you're using Danish translation.

1. Open file /language/da-DK/da-DK.com_jcomments.ini and replace:
Code:
DATE_FORMAT="%d.-%m.-%Y"
TIME_FORMAT="H:i"
DATETIME_FORMAT="%d.-%m.-%Y H:i"
with

Code:
DATE_FORMAT="d-m-Y"
TIME_FORMAT="H:i"
DATETIME_FORMAT="d-m-Y H:i"
« Last Edit: June 11, 2012, 16:31:32 by smart » Logged

If you use JComments, please post a rating and a review at the Joomla! Extensions Directory
zyberchief
Newbie
*

Karma: 0
Offline Offline

Posts: 2


« Reply #7 on: June 29, 2012, 16:19:07 »

Thanks, that worked perfectly  Smiley
Logged
Production
Newbie
*

Karma: 0
Offline Offline

Posts: 6


« Reply #8 on: August 06, 2012, 23:19:16 »


Thanks to Lukit for the workaround, been having this problem since upgrading to 2.3.0.

Just like to note I don't think this is solved. The workaround works, but as Lukit notes, it disconnects the timestamp from the language file.

If anyone knows how to repair while keeping the connection to the language file, please share, thanks.
Logged
Pages: [1]   Go Up
  Print  
JoomlaTune Support Forum    JComments component    Bug-reports    Topic: [solved] Timestamp on published comments showing as Y-m-d H:i
 
Jump to: