jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
Signup
Maven 2.x Project Info Reports Plugin
  • Maven 2.x Project Info Reports Plugin
  • MPIR-171

support "TimeZones" as a timezone

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Trivial Trivial
  • Resolution: Fixed
  • Affects Version/s: 2.1.2
  • Fix Version/s: 2.3
  • Component/s: None
  • Labels:
    None
  • Number of attachments :
    0

Description

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>bob@example.com</email>
    <timezone>Europe/London</timezone>
    <roles>
      <role>developer</role>
    </roles>
  </developer>
</developers>

Currently the site shows NaN for the Current time.

Issue Links

is related to

Improvement - An improvement or enhancement to an existing feature or task. MNG-2202 Improve pom to handle daylight saving changes

  • Minor - Minor loss of function, or other problem where easy workaround is present.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Jerome Lacoste added a comment - 23/Nov/09 6:16 PM - edited

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-list.html	2009-11-23 23:38:37.000000000 +0100
+++ team-list2.html	2009-11-24 11:22:10.000000000 +0100
@@ -521,18 +521,28 @@
 </table>
 </div>
 </div>
+<script type="text/javascript" src="scripts/fleegix.js"></script>
+<script type="text/javascript" src="scripts/date.js"></script>
 <script type="text/javascript">
 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);
-
+    var developerDate;
+    if (offset.indexOf('/') != -1) {
+      var dt = new fleegix.date.Date();
+      dt.setTimezone(offset);
+      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);
+    }
     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.

Show
Jerome Lacoste added a comment - 23/Nov/09 6:16 PM - edited 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-list.html 2009-11-23 23:38:37.000000000 +0100 +++ team-list2.html 2009-11-24 11:22:10.000000000 +0100 @@ -521,18 +521,28 @@ </table> </div> </div> +<script type= "text/javascript" src= "scripts/fleegix.js" ></script> +<script type= "text/javascript" src= "scripts/date.js" ></script> <script type= "text/javascript" > 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); - + var developerDate; + if (offset.indexOf('/') != -1) { + var dt = new fleegix.date.Date(); + dt.setTimezone(offset); + 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); + } 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.
Hide
Permalink
Jerome Lacoste added a comment - 24/Nov/09 3:48 AM - edited

Looks like the new page doesn't work on my Firefox 3.5, but works in opera 10.01 and chromium 4.0.252.0. No error in the javascript console it seems...

page tested and works in opera, ff and chromium. Problem was use of <script/> while page was identified as HTML (due to extension it seems) even if the doctype is XHTML. Thus the loading of the external scripts failed.
Using <script></script> solves it.

Show
Jerome Lacoste added a comment - 24/Nov/09 3:48 AM - edited Looks like the new page doesn't work on my Firefox 3.5, but works in opera 10.01 and chromium 4.0.252.0. No error in the javascript console it seems... page tested and works in opera, ff and chromium. Problem was use of <script/> while page was identified as HTML (due to extension it seems) even if the doctype is XHTML. Thus the loading of the external scripts failed. Using <script></script> solves it.
Hide
Permalink
Anthony Whitford added a comment - 06/Sep/10 3:09 AM

I second the idea of using TimeZone values instead of an integer offset. The offset idea is flawed because it does not account for daylight savings. For example, consider the TimeZone "America/Los_Angeles": Los Angeles is in the Pacific Time Zone, which is GMT-8 during Standard Time and GMT-7 during Daylight Saving Time. Some time zones will not adjust for daylight savings. Finally, countries will change their time zone rules, specifically adjusting when they start and end daylight savings.

Show
Anthony Whitford added a comment - 06/Sep/10 3:09 AM I second the idea of using TimeZone values instead of an integer offset. The offset idea is flawed because it does not account for daylight savings. For example, consider the TimeZone " America/Los_Angeles ": Los Angeles is in the Pacific Time Zone, which is GMT-8 during Standard Time and GMT-7 during Daylight Saving Time. Some time zones will not adjust for daylight savings. Finally, countries will change their time zone rules, specifically adjusting when they start and end daylight savings.
Hide
Permalink
Vincent Siveton added a comment - 01/Nov/10 4:30 PM

I fixed the M3 POM description and updated the code in r1029846, snapshot deployed.

Show
Vincent Siveton added a comment - 01/Nov/10 4:30 PM I fixed the M3 POM description and updated the code in r1029846, snapshot deployed.

People

  • Assignee:
    Vincent Siveton
    Reporter:
    James Nord
Vote (2)
Watch (3)

Dates

  • Created:
    28/Jul/09 8:32 AM
    Updated:
    04/Dec/10 5:06 PM
    Resolved:
    01/Nov/10 4:30 PM
  • Atlassian JIRA (v5.2.7#850-sha1:b2af0c8)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.