Sorry to bother you with this - probably something stupid I am missing, but I'm having trouble with the [comment-date] field. It seems to be generating random numbers.

This is what I have for in my 'submitted by' settings for comments:

Posted by [comment-author-name] on [comment-date] [comment-mon] [comment-yyyy]

The result I get looks like as you'd expect:

Posted by Guest on 1 Nov 2009

Except that the actual day/date is incorrect - and seems relatively random. The date above was pulled from a comment posted today (16th). One posted Saturday, the 14th showed a date of '6 Nov 2009'. four comments from Friday, the 13th all showed '4 Nov 2009'.

I have checked the sitewide 'date & time' settings and they appear normal/correct.

This happening across several sites all using same settings. Example page: http://www.callingbangalore.com/find-a-bangalore-phone-number

I installed the module relatively recently - on/about Nov 3 - prior to that I believe dates were always correct, but now dates going back to before module was installed are wrong. except somehow they aren't becasue they are printing in the correct order.

Comments

NancyDru’s picture

Project: Submitted By » Token
Version: 6.x-1.4 » 6.x-1.12

The comment-date token is provided by the Token module.

flevour’s picture

Category: support » bug

After more investigation on the issue we found out that in token/token_comment.inc

  $values['comment-date']            = date('N', $comment->timestamp); >
is defined as 
<?php    $tokens['comment']['comment-date']            = t("Comment creation date (day of month)");

while date('N') at htpp://php.net/date is
ISO-8601 numeric representation of the day of the week (added in PHP 5.1.0)

So the description should say "day of week" to be correct.
The token name doesn't seem very appropriate for this replacement, anyway.
Cheers,
Francesco

john.kenney’s picture

thanks to flevour for helping me see the obvious in the meaning of the token descriptions.

following on this point, perhaps some other suggested changes to description wording for the day/date items would make things more clear to others.

instead of:

[comment-date]	Comment creation date (day of month)
[comment-day]	Comment creation day (full word)
[comment-ddd]	Comment creation day (abbreviation)
[comment-dd]	Comment creation day (two digit, zero-padded)
[comment-d]	Comment creation day (one or two digit)

i would suggest:

[comment-date]	Comment creation day (day of week)
[comment-day]	Comment creation day (full word)
[comment-ddd]	Comment creation day (abbreviation)
[comment-dd]	Comment creation date (two digit, zero-padded)
[comment-d]	Comment creation date (one or two digit)

main point being that 'day' generally refers to names of the days of the week: 'Monday' 'Tuesday', etc. (or substitutes thereof). 'date' refers to numerical day of the month: 1, 2, 3, ..., 30, 31.

Dave Reid’s picture

Status: Active » Closed (duplicate)