I made a Custom Format that looks like this:
“l, F j<\sup>S @ 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 tried updating to the newest -dev version (09-June-2009 — the same thing was happening with the 08-June-2009 version, and with all previous -dev and official releases), clearing all caches, etc.

This happens wherever Long Dates are shown, regardless of whether it’s in Calendar Views, Event CCK Details, etc.

Example site: http://drupal.kreweofgemini.com/

Comments

Joel MMCC’s picture

Title: Custom Format Date/Time separator character appears AFTER the Time, even if placed BEFORE! » “@” as Custom Format Date/Time separator character appears AFTER the Time, even if placed BEFORE!
Priority: Normal » Minor

Ooops! I keep forgetting that HTML is interpreted in these posts!

Also, as per the PHP docs, all non-punctuation characters that are intended to be passed through should be backslash-escaped, even if the current PHP date() function doesn’t assign them any special meaning — future versions might! It doesn’t hurt to do it to punctuation characters, too.

Thus, the first Custom Format in my above post should read:
“l, F j\<\s\u\p\>S\<\/\s\u\p\> @ g:ia”

I had also tried backslash-escaping the “@” like so:
“l, F j\<\s\u\p\>S\<\/\s\u\p\> \@ g:ia”
but to no avail.

But then I tried using characters other than an “@” — both colon (“:”) and comma (“,”) work fine. They’re not really what I wanted, but the comma will do for now.

I’ve demoted this to “minor” status and retitled it to be more accurate.

trikegirl’s picture

Version: 6.x-2.x-dev » 6.x-2.3

I am currently experiencing this issue as well when trying to use a bullet separator between date and time. I'm using the latest version of Date, released on 7/29/09.

HnLn’s picture

I have s similar issue

I want my date to display as d.m.Y \o\m H\ui (dutch).

Which adds "omy" at the end of the date strings. I figured out this is the $timezone argument passed on the date theme functions. It shouldn't displayed and if it would need to it wouldn't need the "om" (same as "at" in english).

My workaround was overriding the theme functions and drop the $timezone variable (as my current site doesn't need it).

HnLN

JayKayAu’s picture

I have the same problem too when trying to get something like this:

"\W\e\e\k W, \S\t\a\r\t\i\n\g \o\n l, jS \o\f F"
"Week 33, Starting on Monday, 10th of August"

Joel MMCC’s picture

Version: 6.x-2.3 » 7.x-2.x-dev

This issue still happens in Version 7.x-2.x-dev under Drupal 7 (as of 7.9) as well!

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 “@”!

New D7 example staging site: http://sbsc.sell2unow.com/

KarenS’s picture

Version: 7.x-2.x-dev » 6.x-2.3

First of all, please don't switch issues from D6 to D7 or they won't get fixed in either version. Second, you have not escaped the @.

Joel MMCC’s picture

Sorry about that version-changing thing.

Anyway, I tried escaping the “@” (with a backslash, right? As I said about 2½ years ago in my first comment, I had already done that back in the D6 version, to no avail), and it still does it in D7 as well!

New long date format:
l, F j<\s\u\p>S</\s\u\p>, Y \@ g:ia

Displays as (in HTML):
Saturday, October 29<sup>th</sup>, 2011 @ 4:00pm <sup></sup> @

Since the site has to go live soon, I went ahead and used the less-desirable comma instead of at-sign as the date/time separator. I suppose I could also use the word “at” by escaping it (“ \a\t ”).

Draven_Caine’s picture

I have the same issue also in D7, been trying to chase this one down for a few days.
\ dont help, also i have 2 date formats which i'll throw in there it might help someone.

  • 2/25/12 (7:00pm EST) gets printed as 2/25/12 (7:00pm EST) ( ) (notice the add ())
  • Feb 25, 2012 7:00pm @ gets printed as Feb 25, 2012 7:00pm @ (notice the @ symbol being at the end not between the date and time like it should)

Now if this is date, core or what is beyond me, but this is a drupal 7 issue for me.

mkeiser’s picture

There are several regular expressions in the date_limit_format() function (date_api.module file).
It seems the piece of the regular expressions:
\-/\.,:
is escaping certain characters from being part of the date format.
Changing each occurrence (9 of them) to:
\@\-/\.,:
appears to solve the problem in my case.
I am not sure if this fixes the problem in all cases, or if there is other fallout.

Joel MMCC’s picture

As KarenS requested ½ year ago in #6, instead of changing the Version of this Issue to 7.x, I created a new Issue: #1538420: Custom characters intended as separators within custom formatted date/time are not displayed in the correct location.. Those of you Following this Issue, please post there if you have similar problems with 7.x-2.x., or at least Follow it as well. I suspect most future discussion will take place in that thread.

Itangalo’s picture

For information: This is most likely an issue that can be solved in the same way as #752550: Week number gets printed twice.
(It's still a bug, and it should be solved, but there is a way for solving it.)

DamienMcKenna’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

Unfortunately the Drupal 6 version of the Date module is no longer supported. That said, we appreciate that you took time to work on this issue. Should this request still be relevant for Drupal 7 please feel free to reopen it. Thank you.