Uploaded image for project: 'Velocity Tools'
  1. Velocity Tools
  2. VELTOOLS-108

The DateTool can be trivially enhanced to support configurable TimeZone.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.0
    • 2.0
    • GenericTools
    • None
    • JDK 1.5, 1.6

    Description

      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; }

      Attachments

        Activity

          People

            Unassigned Unassigned
            ezra_epstein@yahoo.com Ezra Epstein
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 5m
                5m
                Remaining:
                Remaining Estimate - 5m
                5m
                Logged:
                Time Spent - Not Specified
                Not Specified