Maven 1.x XDoc Plugin
  1. Maven 1.x XDoc Plugin
  2. MPXDOC-35

xdoc-generated team list assumes an offset of -20 from GMT

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      maven-xdoc-plugin-1.4-SNAPSHOT, also exists in current HEAD as of reporting date
    • Number of attachments :
      0

      Description

      The xdoc plugin uses velocity:merge to generate a team list from the pom data, using the plugin-resources\templates\team-list.xml template. This template contains the following JavaScript:

      function offsetDate(id, offset) {
      var date = new Date();
      var dateOffset = new Date(
      Date.UTC(
      date.getFullYear(),
      date.getMonth(),
      date.getDate(),
      date.getHours(),
      date.getMinutes(),
      date.getSeconds()
      ) + (offset - 20) *60*60*1000);

      document.getElementById(id).innerHTML = dateOffset;
      }

      JavaScript isn't my forte, but I believe this code assumes that the time zone offset given in the pom is going to be -20 offset from the browser's computer's time zone?

      After a crash course in JavaScript this evening I think the following may work better:

      function offsetDate(id, offset)
      {
      var now = new Date() ;
      var nowTime = now.getTime() ;
      var localOffset = now.getTimezoneOffset() ;
      var developerTime = nowTime + (offset * 60 * 60 * 1000) + (localOffset * 60 * 1000) ;
      var developerDate = new Date(developerTime) ;

      document.getElementById(id).innerHTML = developerDate;
      }

      I strongly suggest people give it a go in a few different timezones before applying it! As I say I'm not a JavaScript guy, and may have totally the wrong end of the stick.

        Activity

        Hide
        Charlie Dobbie added a comment -

        I should add that it works for me: WinME, GMT+1, IE5.5 and Mozilla 1.4.

        To anyone who wants to try it: generate your site ("maven site"), edit target/docs/team-list.html and replace the current function with the new one. Then open the page and check the entries in the "Time" column are correct given the offset from GMT in "TZ Offset".

        Show
        Charlie Dobbie added a comment - I should add that it works for me: WinME, GMT+1, IE5.5 and Mozilla 1.4. To anyone who wants to try it: generate your site ("maven site"), edit target/docs/team-list.html and replace the current function with the new one. Then open the page and check the entries in the "Time" column are correct given the offset from GMT in "TZ Offset".
        Hide
        dion gillard added a comment -

        This looks cleaner. I'm testing it now.

        Show
        dion gillard added a comment - This looks cleaner. I'm testing it now.
        Hide
        dion gillard added a comment -

        Fix applied

        Show
        dion gillard added a comment - Fix applied

          People

          • Assignee:
            Unassigned
            Reporter:
            Charlie Dobbie
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: