I'm running Drupal 5.0 (not 5.1) and it is solid as a rock but has this little issue with the date stamping of comments:

They all read as "Posted on December 31st, 1969".

Is this a known problem?
Is there a fix?
Am I in a Time Warp?

Comments

zirafa’s picture

Try a different theme and see if it still happens. I'm guessing something in your theme (specifically node.tpl.php) might be responsible.

InterceptPoint’s picture

I tried it with a couple of themes and it shows the correct date when previewing but still shows 1969 when posted. It looks like a bug to me. I used Garland and Golden Hour. Garland for sure should be bug-free.

ChrisKennedy’s picture

Try disabling and then re-enabling comment.module

InterceptPoint’s picture

While in the process of turning the comment module off and on again I had a closer look at the comments. They are all dated correctly in the database. They all do in fact show correctly in Garland and a few other themes that I tried. The problem is with Golden Hour which does not pick up the date correctly for some reason. I'll try and post something to the Golden Hour guy/gal and see if it really is a bug or is something in my system.

Thanks for the help.

InterceptPoint

wimmera’s picture

In the Golden Hour theme's comment.tpl.php file

change:

to:

I'm not sure what the Golden Hour theme author is attempting to do, but the code does not work. Replacing it with the default code allows the Golden Hour theme to display the author and date properly in comments.

.carey’s picture

Just in case anyone upgrades to 5.x and used custom dates in 4.7:

The above date format used in the Golden Hour theme is a custom date format that works in 4.7 -- but apparently does not in 5.x.

It reads 'By username - Posted on Month day, Year'.

Cheers.

.carey’s picture

The custom date format that the Golden Hour theme is using can be achieved with this code:

change:

<?php
print t('By ') . theme('username', $node) . t(' - Posted on ') . format_date($node->created, 'custom', "F jS, Y");
?>

to:

<?php print t('By !username - Posted on !date', array('!username' => theme('username', $node), '!date' => format_date($node->created, 'custom', "F jS, Y"))); ?>

Cheers, again. :)

alienresident’s picture

I ran into this problem with a Zen based custom theme—it may have been fixed for this theme by now.

But the problem is that the comment.tpl.php is calling the node created time and not the comment timestamp. They are stored in different database tables (to reduce the overhead). The author's code will work only in the node.tpl.php.

print t('By ') . theme('username', $node) . t(' - Posted on ') . format_date($node->created, 'custom', "F jS, Y");

should be

print t('By ') . theme('username', $node) . t(' - Posted on ') . format_date($comment->timestamp, 'custom', "F jS, Y");

I am assuming the Golden Hour Author is just customizing the formatting of the comments date.

mschlanser’s picture

hey all,

This might have been answered already somewhere else but i thought i would give some code to the cause.

I changed the file node.tpl.php in the theme im using. I was noticing that the preview was always showing that date but when the post was generated the correct date time was used. this was really annoying for some reason ( just anal i guess ). Anyway, heres the code that I changed.

<?php if ($submitted): ?>
        <?php if ($node->created): ?>
      <div class="submitted"><?php print t('Posted !date by !name', array('!date' => format_date($node->created, 'custom', "F jS, Y"), '!name' => theme('username', $node))); ?></div>
        <?php endif; ?>
        <?php if (!$node->created): ?>
        <div class="submitted"><?php print t('Posted !date by !name', array('!date' => date('F d, Y  g:i A',time()), '!name' => theme('username', $node))); ?></div>
        <?php endif; ?>
    <?php endif; ?>

The first div is used for all posts that have ALREADY been created. since the preview section hasn't been created yet this doesn't exist. so the second will get the current date / time for the preview.

Thanks All,
Mike