The DateTool can be trivially enhanced to support configurable TimeZone.
------------------------------------------------------------------------

                 Key: VELTOOLS-108
                 URL: https://issues.apache.org/jira/browse/VELTOOLS-108
             Project: Velocity Tools
          Issue Type: Improvement
          Components: GenericTools
    Affects Versions: 2.0
         Environment: JDK 1.5, 1.6
            Reporter: Ezra Epstein
            Priority: Minor
             Fix For: 2.0


Enhance the DateTool with:

        /**
         * The key used for specifying a default format via tool configuration.
         */
        public static final String TIMEZONE_KEY = "timezone";

        private TimeZone timezone = TimeZone.getDefault();

        /**
         * Does the actual configuration. This is protected, so
         * subclasses may share the same ValueParser and call configure
         * at any time, while preventing templates from doing so when
         * configure(Map) is locked.
         */
        protected void configure(ValueParser values) {
            super.configure(values);

            String tzId = values.getString(TIMEZONE_KEY);
            if (tzId != null) {
                setTimezone(TimeZone.getTimeZone(tzId));
            }
        }

        // Replace current getTimezone() method with:
        public TimeZone getTimezone() {
                return timezone;
        }

        public void setTimezone(TimeZone timezone) {
                this.timezone = timezone;
        }



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to