You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by ji...@codehaus.org on 2003/11/09 16:21:04 UTC

[jira] Closed: (MAVEN-962) xdoc-generated team list assumes an offset of -20 from GMT

Message:

   The following issue has been closed.

   Resolver: dion gillard
       Date: Sun, 9 Nov 2003 9:20 AM

Fix applied
---------------------------------------------------------------------
View the issue:

  http://jira.codehaus.org/secure/ViewIssue.jspa?key=MAVEN-962


Here is an overview of the issue:
---------------------------------------------------------------------
        Key: MAVEN-962
    Summary: xdoc-generated team list assumes an offset of -20 from GMT
       Type: Bug

     Status: Closed
   Priority: Minor
 Resolution: FIXED

 Time Spent: Unknown
  Remaining: Unknown

    Project: maven
 Components: 
             plugin-xdoc
   Fix Fors:
             1.0-rc2
   Versions:
             1.0-beta-10

   Assignee: 
   Reporter: Charlie Dobbie

    Created: Wed, 22 Oct 2003 7:57 PM
    Updated: Sun, 9 Nov 2003 9:20 AM
Environment: maven-xdoc-plugin-1.4-SNAPSHOT, also exists in current HEAD as of reporting date

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.


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org