controlling date format

23 views
Skip to first unread message

Nuno Zimas

unread,
Mar 16, 2015, 6:47:57 PM3/16/15
to eea-...@googlegroups.com
Although we have uploaded spreadsheet with date values as YYYY-DD-MM, Exhibit will always translate this format into a descriptive output, which is both counterintuitive and hard to read.
For instance, instead of 2006-01-07 (which the actual value in the Date:date column), it is displaying "Mon, Jan 2, 2006, 12:00 am" in the tabular view.
Is thee any way the date format can be overridden at the lens template level?

Please see attached screenshots for further clarification.


Screenshot 2015-03-16 22.10.04.png
Screenshot 2015-03-16 22.47.24.png

Zoltan Szabo

unread,
Mar 18, 2015, 9:16:55 AM3/18/15
to eea-...@googlegroups.com
Hi,

The easiest way is to customize the main_template and add to the body something like: ex:formats="date{time-zone:4;template:'yyyy/MM/dd';  show:date}"
The problem with this solution is that it will be global.

Nuno Zimas

unread,
Mar 18, 2015, 5:08:11 PM3/18/15
to eea-...@googlegroups.com
Thanks Zoltan.

I’ve added the line you suggest to the body tag in the main_template file, but there has been no change in the date format.

Right now, the body tag looks as follows:

<body tal:define="isRTL portal_state/is_rtl;
                  sl python:plone_view.have_portlets('plone.leftcolumn', view);
                  sr python:plone_view.have_portlets('plone.rightcolumn', view);
                  body_class python:plone_view.bodyClass(template, view);
                  classes python:context.restrictedTraverse('@@sunburstview').getColumnsClasses(view)"
    tal:attributes="class body_class;
                    dir python:isRTL and 'rtl' or 'ltr'" ex:formats="date{time-zone:4;template:'yyyy/MM/dd';  show:date}”>

Was wondering if it could be either a cache related issue, a syntax error or if the attribute should go elsewhere.

Zoltan Szabo

unread,
Mar 19, 2015, 4:15:49 AM3/19/15
to eea-...@googlegroups.com
Hi,

Are you changing the main_template directly on the file system or inside ZMI?
Can you check if in the source of the page contains the modified code for the body?
When I tried your snippet, I noticed the ending quote character was different.

Here is my body tag, you could try it:

<body 
    ex:formats="date{time-zone:4;template:'yyyy/MM/dd';  show:date}"
    tal:define="isRTL portal_state/is_rtl;
                  sl python:plone_view.have_portlets('plone.leftcolumn', view);
                  sr python:plone_view.have_portlets('plone.rightcolumn', view);
                  body_class python:plone_view.bodyClass(template, view);
                  classes python:context.restrictedTraverse('@@sunburstview').getColumnsClasses(view)"
    tal:attributes="class body_class;
                    dir python:isRTL and 'rtl' or 'ltr'">

Nuno Zimas

unread,
Mar 19, 2015, 3:30:39 PM3/19/15
to eea-...@googlegroups.com

I’ve added the line to the main_template via ZMI.
Still no changes in the fronted views.




-- 
You received this message because you are subscribed to a topic in the Google Groups "EEA Daviz" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/eea-daviz/YMwDaVJLYT4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to eea-daviz+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nuno Zimas

unread,
Mar 19, 2015, 4:08:56 PM3/19/15
to eea-...@googlegroups.com
Think I understand where the problem lies.
SunRain is a Diazo theme and it is not picking markup from main_template.
When I deactivate the theme and leave a barebones Plone skin, however, the date format is altered.

I’ve tried to add ex:formats="date{time-zone:4;template:'yyyy/MM/dd';  show:date}” to the index.html file in the SunRain theme, but it didn’t work. In the theme rules file I can’t find any obvious place to add the attribute.

Where shall I add the custom ex:formats attribute so that a diazo theme can parse it? 

On 19 Mar 2015, at 08:15, Zoltan Szabo <zoltansz...@gmail.com> wrote:

Reply all
Reply to author
Forward
0 new messages