I have a silly system where I define strftime patterns in a YAML file.
And at run time I create LIST_OPS vmethods based on those names and
patterns.

Then in the templates I can do this on DateTime objects:

    [% event_time.time_brief %]
    [% event_time.time_full %]
    [% event_time.date_no_year %]


Of course, now I want to have some methods that adjust the timezone
and locale based on user preferences.  I have the timezone and the
locale available in the stash.

Well, for locale I can call DateTime->DefaultLocale() at the start of
every request before calling process().   But I need to call
set_time_zone() on the DateTime objects when they are used.  But,
IIRC, the context isn't available to vmethods.  Correct?

What's a good approach?

    Macros:  time_full( event_time ) ?

    Filter:  event_time | time_full ?


I'm setting the locale globally (per request) so I suppose another
approach would be to put the timezone in a global as well.




-- 
Bill Moseley
[EMAIL PROTECTED]


_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to