I have a date format as follows: F jS, Y @ g:iA

This displays fine in both the Types and Formats screens as, for example, September 7th, 2012 @ 2:00AM

But when a date is actually displayed on the site, either through a regular node or in a View, It moves the @ symbol to the end, and shows: September 7th, 2012 2:00AM @

I've tested it with other strings, and they work fine. It's only with the "@" symbol.

CommentFileSizeAuthor
#3 1710796.patch808 bytesmonish_deb

Comments

karens’s picture

Status: Active » Closed (works as designed)

As noted in the documentation and numerous other issues, you have to escape characters that are not a part of the date format string, i.e. \@.

kiwimind’s picture

Unfortunately this does not seem to be the case. I have a date formatter as D M j \@ H:i and the @ still shows at the end of the string when it is being written to the page.

I have also tried double escaping it (D M j \\@ H:i) and the same applies.

I have had a pick through some of the other issues, which seem to be more about the date being output twice. This is not the case for me.

Screengrabs:
format string
views date format selection
output

monish_deb’s picture

Version: 7.x-2.5 » 7.x-2.6
Status: Closed (works as designed) » Active
StatusFileSize
new808 bytes

I have gone through the issue and found the reason why the '@' is appended at the end of the Date string. The issue was occurring in

    • theme_date_display_combination() function where at line 134
      $timezone = $dates['value']['formatted_timezone'];
      (Here $date is the formatted date array set in date_formatter_process() function at date.module file)
    • The format string for timezone leaves '@' which is then replaced from date value at line 138
      $date1 = str_replace($timezone, '', $date1);
     $date2 = str_replace($timezone, '', $date2);
    • Later on appended at end of the date string at line 230 of theme_date_display_single() function
      return '<span class="date-display-single"' . drupal_attributes($attributes) . '>' . $date . $timezone . '</span>';
  • I am submitting the patch for this issue but I think there must be a $replace array like in date_limit_format() at date_api.module which replaces such character from formatted timezone, formatted time etc. Any suggestion?

    wigglykoala’s picture

    I believe this to be a duplicate of https://drupal.org/node/1976898

    Creating a custom module with the code provided on the other issue fixed the problem for me. I didn't try the above patch but I too had this problem. Escaping a dash didn't work and no matter what I put in the formatter the non english character would end up at the end of the string.

    wigglykoala’s picture

    Issue summary: View changes

    Spelling error.

    damienmckenna’s picture

    Version: 7.x-2.6 » 7.x-2.x-dev
    Issue summary: View changes
    Status: Active » Needs review

    Thanks for the patch, we'll try to review it soon.

    BTW when you upload a patch it helps to set the status to "needs review", that triggers the testbots and lets others know that there's something review.

    Status: Needs review » Needs work

    The last submitted patch, 3: 1710796.patch, failed testing. View results

    steinmb’s picture