As a designer, we've had to pull a lot of design punches because we can't target dates or times separately with CSS. Ideally, we'd be able to style each field of output separately to achieve designs to match any calendar application or printed day planner out there.
For full flexibility, start and end dates would need to be inside their own div or span containers, as parents to the various date components:
start date
day of week
day
month
year
h:
m
am/pm (this could be handled as small caps, e.g.)
end date
day of week
day
month
year
h:
m
am/pm (this could be handled as small caps, e.g.)
Comments
Comment #1
karens commentedFirst of all, feature requests are not 'critical' (even if they are critical to you, critical on this issue queue means the software is broken without it).
Second, I have gone to great lengths to wrap every possible part of the date output in themes, there are dozens of theme functions and templates in Date and Calendar and they are there so everyone can theme things the way they like. Look in the files labeled 'theme' for some of them. There are themes for each individual part of the date, for the labels, for the titles, for the 'All day' text, for the calendar date box and each individual calendar item and the dates within each calendar item, etc etc etc.
I have discovered that it is totally impossible to come up with any theme that makes everyone happy. If I add all these divs I absolutely guarantee I will immediately get a 'critical' request to remove them (because I've already had requests to get rid of the divs that are already there).
So I've tried to take a middle of the road path and you can override everything in your theme to do something else.
Comment #2
fxarte commentedI was also needing to add extra HTML code to the datetime elements and this is what I did:
<\d\iv \c\l\a\s\s="\m">M</\d\iv><\d\iv \c\l\a\s\s="\d">d</\d\iv><\d\iv \c\l\a\s\s="\y">Y</\d\iv>you must be carefull with the backslashes, they keep the date engine from interpreting them as date formating strings, like the php date function would do.
This method has some limitations
Comment #3
fxarte commentedI was looking for the theme functions and came down to override the output of "theme_date_display_single", but everything stopped when I found out that the argument of the function: "$date", has the value already formatted, so, if I would, for instance, want this function to render something like the code bellow, it would not be possible.
One solution, may be, is to include in the function argument the datetime value making $date an array for instance:
$date = array (
'formatted'=>{formatted value, what is now being passed},
'value'=>{raw value},
)
Comment #4
Simsalabim commentedI tried the same as fxarte in the comment above. This works well, but has one bug: If you just post a single date (just a start date), for example for concerts, the classes will also appear for the empty end date.
In my HTML-Site the code looks like this:
When I now style these CSS-classes, the styles also apply for the empty div-containers. That´s not good.
Has anyone an idea how I could get rid of the empty containers?
Thanks in advance.
Comment #5
danny englanderThis worked great, thanks!
Comment #6
rbrownellI strongly disagree with the dismissial of this issue. In fact just reading it offended me. I understand that there is a lot of hard work that goes into this module, but it is important to remember that not everything can/should be themed.
Example? I was trying build a simple shopping cart form with this and other modules, and kept running into problems because CSS styling would end up in inside the value fields and corrupt the HTML.
I had a hard time finding this solution, but once I found it it was as clear as day.
Select "Strip HTML tags" in the options for the field in the view. It worked for me. Hopefully someone can benefit from my 3 hours of searching for this solution.
Comment #7
karens commentedI have devoted thousands of hours of (free) work to this module over the last three years and made thousands of commits to this module. I think that gives me the right to say something is not critical without being called arrogant.
Comment #8
Bevan commentedSimsalabim #4; See #1049450: Empty <div>s are rendered.
Comment #9
woprrr commentedI thinks this solution is good for override render specific format date :