[ 
http://jira.codehaus.org/browse/MPIR-171?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=199162#action_199162
 ] 

Jerome Lacoste commented on MPIR-171:
-------------------------------------

I've implemented a HTML version of the team-list that uses 
http://js.fleegix.org/plugins/date/date
to support "String" timezones.

See http://coffeebreaks.org/tmp/mvn-mpir-171/team-list2.html for demo

the diff to the generated files is

--- team-list2.html     2009-11-24 01:07:46.000000000 +0100
+++ team-list.html      2009-11-23 23:38:37.000000000 +0100
@@ -521,29 +521,18 @@
 </table>
 </div>
 </div>
-<script type="text/javascript" src="scripts/fleegix.js"/>
-<script type="text/javascript" src="scripts/date.js"/>
 <script type="text/javascript">
 function offsetDate(id, offset) {
-    var developerDate;
-    if (offset.indexOf('/') != -1) {
-      var dt = new fleegix.date.Date();
-      dt.setTimezone(offset);
-      offset = - dt.getTimezoneOffset() / 60;
-      developerDate = new Date(dt);
-    } else {
-      var now = new Date();
-      var nowTime = now.getTime();
-      var localOffset = now.getTimezoneOffset();
-      var developerTime = nowTime + ( offset * 60 * 60 * 1000 )+ ( localOffset 
* 60 * 1000 );
-      developerDate = new Date(developerTime);
-    }
+    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;
 }
 
 function init(){
-    fleegix.date.timezone.zoneFileBasePath = './tz/';
-    fleegix.date.timezone.init();
     offsetDate('developer-0', '-5');
     offsetDate('developer-1', '+1');
     offsetDate('developer-3', '+1');

general drawbacks of such a solution
* the pages generate more traffic (javascripts, zoneInfo files)
* zoneInfo values may not be valid in the future (pages may not work in some 
years if the tz isn't updated)


the drawbacks of the current demo:
* the zoneInfo files are not trimmed for space
* we use a simple check to identify String timezones. Is it robust enough ?
* there should probably be some try/catch to detect issues.

Ideally the method offsetDate() should be renamed.

Let me know if that seems interesting, and I can look into changing the code to 
support this.






> support "TimeZones" as a timezone
> ---------------------------------
>
>                 Key: MPIR-171
>                 URL: http://jira.codehaus.org/browse/MPIR-171
>             Project: Maven 2.x Project Info Reports Plugin
>          Issue Type: Improvement
>    Affects Versions: 2.1.2
>            Reporter: James Nord
>            Priority: Trivial
>
> The POM XSD defiens the TimeZone as an xs:string (although the descriptions 
> says an integer between -11 and 12)
> If the desctription is enforced you can not be in a timezone that is not a 
> multiple of 1 hour away from UTC (e.g. certain parts of india)
> So the description is wrong and it's just a String.  
> So why not support a full formatted timezone such as Europe/London, then the 
> mpir can use funky javascript to show your actual time including any daylight 
> saving offset. (as opposed to a fixed offset from GMT ignoring DST changes)
> e.g. support
>         <developers>
>                 <developer>
>                         <id>bob</id>
>                         <name>Bob Hacker</name>
>                         <email>b...@example.com</email>
>                         <timezone>Europe/London</timezone>
>                         <roles>
>                                 <role>developer</role>
>                         </roles>
>                 </developer>
>         </developers>
> Currently the site shows NaN for the Current time.

-- 
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
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to