Show 'AM/PM' for Datetime edit

14 views
Skip to first unread message

Jim Baack

unread,
Dec 11, 2012, 12:26:44 AM12/11/12
to dexterity-...@googlegroups.com
I'm sure its easy - but not finding it. I need to show AM/PM - I see it is off by default in the Datetime widget. How do I set it on? Thanks.    Jim

Sean Upton

unread,
Dec 11, 2012, 12:36:01 AM12/11/12
to dexterity-...@googlegroups.com, Johannes Raggam
On Mon, Dec 10, 2012 at 10:26 PM, Jim Baack <jba...@accelerantsys.com> wrote:
> I'm sure its easy - but not finding it. I need to show AM/PM - I see it is
> off by default in the Datetime widget. How do I set it on? Thanks. Jim

Maybe this has improved, but I believe that this needs some
configurability in registry and control panel. An ugly hack, but you
can work around this by monkey-patching this per-install in a policy
product, like so:

https://github.com/seanupton/uu.eventintegration/blob/master/uu/eventintegration/patch.py#L39

Sean

David Glick (Plone)

unread,
Dec 11, 2012, 12:37:21 AM12/11/12
to dexterity-...@googlegroups.com, Sean Upton, Johannes Raggam
We should at least make this do what the Archetypes and formlib widgets
do to arrive at a more reasonable default:

portal_state = getMultiAdapter((context, self.request),
name=u'plone_portal_state')
dates = portal_state.locale().dates
timepattern = dates.getFormatter('time').getPattern()
if 'a' in timepattern:
use_ampm = True

Reply all
Reply to author
Forward
0 new messages