This is a deliberate sort-of duplicate of the 2¾-year-old #486862: “@” as Custom Format Date/Time separator character appears AFTER the Time, even if placed BEFORE! for 6.x-2.x, which KarenS said (in #6) had to be made into a separate issue for the 7.x version, so here it is. It’s still happening, even in the latest 7.x-2.x!
I made a Custom Format that looks like this:
“l, F j<\s\u\p></\s\u\p> @ g:ia”
and assigned it as my Long Date Format.
It’s supposed to display like this:
“Tuesday, June 9th @ 12:34pm”
Instead, we see this:
“Tuesday, June 9th @ 12:34pm @”
Note the second “@” that appears after the whole thing.
If I leave off the HTML that was added to make the ordinal suffix into a superscript (as it should be for best appearance), it gets even worse: the first (intended) “@” disappears, leaving only the second (incorrect) one, like so:
“Tuesday, June 9th 12:34pm @”
I triedc learing all caches, updating to dev releases, etc.
This happens wherever Long Dates are shown, regardless of whether it’s in Calendar Views (e.g. Upcoming Events), Event CCK or Fieldable Entity Details, etc.
It happens with all 6.x. and 7.x versions to date that I’ve tried.
I had also tried backslash-escaping the “@” and HTML tag angle brackets (basically every character that was not a PHP date/time placeholder or standard date punctuation [space, comma, colon, etc.]), like so:
“l, F j\<\s\u\p\>S\<\/\s\u\p\> \@ g:ia”
but to no avail.
I even tried using the word “at” (escaped as “\a\t”) instead of “@”! Same result.
But then I tried using characters other than an “@” — standard PHP date/time-separator characters such as colon (“:”) and comma (“,”) work fine (sort of — they display fine, but still generate undesirable extraneous HTML — see below). They’re not really what I wanted, but I suppose the comma will do for now.
Weird thing is, all of these look just fine, as intended, in the previews shown in the “Configuration → Regional and language → Date and time → Date formats” (…admin/config/regional/date-time/formats) page! It’s only when anything involving Date API displays them that they mess up!
In looking at the actual generated HTML code, it turns out that more than just the “@” is being duplicated in my case:
“l, F j\<\s\u\p\>S\<\/\s\u\p\> @ g:ia”
gives, for instance (in HTML, substituting single angle quotes for angle brackets here to prevent them from being interpreted as HTML tags):
“Tuesday, June 9‹sup›th‹/sup› @ 12:34pm ‹sup›‹/sup› @”
As you can see, the “‹sup›‹/sup›” tags and an extra space are being duplicated as well as the “@”! Those tags also wind up duplicated even if I use a standard separator character such as comma or colon or hyphen, but at least in those cases they’re empty and so have no visual effect (would still potentially mess things up for visually impaired accessibility methods, HTML validation and thus SEO rankings, etc.)
Others in that 6.x Issue thread reported that other non-standard separator characters also wind up duplicated, including (#2) bullets (“•”), (#8) surrounding the time portion in parentheses (causes empty parentheses to appear after the time, like this: “2/25/12 (7:00pm EST) ( )”), etc.
One @mkeiser there (#9) seems to have tracked down the cause to some RegExs in the date_limit_format() function (date_api.module file in the 6.x) and even proposed a potential fix which worked for him/her, but this has still not been fixed.