W3C validator doesn't like timezones without colons, even though the spec says it's ok
W3C validator doesn't like timezones without colons, even though the spec says it's ok

--- a/include/git/commit/Commit.class.php
+++ b/include/git/commit/Commit.class.php
@@ -322,12 +322,17 @@
 	/**
 	 * Gets the author's timezone
 	 *
+	 * @param boolean $separator true to return with separator
 	 * @return string author timezone
 	 */
-	public function GetAuthorTimezone()
-	{
-		if (!$this->dataRead)
-			$this->ReadData();
+	public function GetAuthorTimezone($separator = false)
+	{
+		if (!$this->dataRead)
+			$this->ReadData();
+
+		if ($separator && preg_match('/^([+\-][0-9][0-9])([0-9][0-9])$/', $this->authorTimezone, $regs)) {
+			return $regs[1] . ':' . $regs[2];
+		}
 
 		return $this->authorTimezone;
 	}
@@ -390,12 +395,17 @@
 	/**
 	 * Gets the author's timezone
 	 *
+	 * @param boolean $separator true to return with separator
 	 * @return string author timezone
 	 */
-	public function GetCommitterTimezone()
-	{
-		if (!$this->dataRead)
-			$this->ReadData();
+	public function GetCommitterTimezone($separator = false)
+	{
+		if (!$this->dataRead)
+			$this->ReadData();
+
+		if ($separator && preg_match('/^([+\-][0-9][0-9])([0-9][0-9])$/', $this->committerTimezone, $regs)) {
+			return $regs[1] . ':' . $regs[2];
+		}
 
 		return $this->committerTimezone;
 	}

--- a/include/git/tag/Tag.class.php
+++ b/include/git/tag/Tag.class.php
@@ -272,12 +272,17 @@
 	/**
 	 * Gets the tagger timezone
 	 *
+	 * @param boolean $separator true to return with separator
 	 * @return string tagger timezone
 	 */
-	public function GetTaggerTimezone()
-	{
-		if (!$this->dataRead)
-			$this->ReadData();
+	public function GetTaggerTimezone($separator = false)
+	{
+		if (!$this->dataRead)
+			$this->ReadData();
+
+		if ($separator && preg_match('/^([+\-][0-9][0-9])([0-9][0-9])$/', $this->taggerTimezone, $regs)) {
+			return $regs[1] . ':' . $regs[2];
+		}
 
 		return $this->taggerTimezone;
 	}

--- a/templates/blame.tpl
+++ b/templates/blame.tpl
@@ -52,7 +52,7 @@
 	  <tr class="{$rowclass}">
 	    <td class="date">
 	      {if $blamecommit}
-	        <a href="{geturl project=$project action=commit hash=$blamecommit}" title="{$blamecommit->GetTitle()|escape}" class="commitTip"><time datetime="{$blamecommit->GetAuthorEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+0000"}">{$blamecommit->GetAuthorEpoch()|date_format:"%Y-%m-%d %H:%M:%S"}</time></a>
+	        <a href="{geturl project=$project action=commit hash=$blamecommit}" title="{$blamecommit->GetTitle()|escape}" class="commitTip"><time datetime="{$blamecommit->GetAuthorEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+00:00"}">{$blamecommit->GetAuthorEpoch()|date_format:"%Y-%m-%d %H:%M:%S"}</time></a>
 	      {/if}
 	    </td>
 	    <td class="author">

--- a/templates/blamedata.tpl
+++ b/templates/blamedata.tpl
@@ -12,7 +12,7 @@
     {if $opened}</div>{/if}
     <div class="{cycle values="light,dark"}">
     {assign var=opened value=true}
-    <a href="{geturl project=$project action=commit hash=$blamecommit}" title="{$blamecommit->GetTitle()|escape}" class="commitTip"><time datetime="{$blamecommit->GetAuthorEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+0000"}">{$blamecommit->GetAuthorEpoch()|date_format:"%Y-%m-%d %H:%M:%S"}</time></a>
+    <a href="{geturl project=$project action=commit hash=$blamecommit}" title="{$blamecommit->GetTitle()|escape}" class="commitTip"><time datetime="{$blamecommit->GetAuthorEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+00:00"}">{$blamecommit->GetAuthorEpoch()|date_format:"%Y-%m-%d %H:%M:%S"}</time></a>
     {$blamecommit->GetAuthorName()|escape}
   {/if}
   <br />

--- a/templates/commit.tpl
+++ b/templates/commit.tpl
@@ -31,12 +31,12 @@
      <tr>
        <td></td>
        <td>
-       <time datetime="{$commit->GetAuthorEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+0000"}">{$commit->GetAuthorEpoch()|date_format:"%a, %d %b %Y %H:%M:%S %z"}</time>
+       <time datetime="{$commit->GetAuthorEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+00:00"}">{$commit->GetAuthorEpoch()|date_format:"%a, %d %b %Y %H:%M:%S %z"}</time>
        {assign var=hourlocal value=$commit->GetAuthorLocalEpoch()|date_format:"%H"}
        {if $hourlocal < 6}
-       (<time datetime="{$commit->GetAuthorLocalEpoch()|date_format:"%Y-%m-%dT%H:%M:%S"}{$commit->GetAuthorTimezone()}"><span class="latenight">{$commit->GetAuthorLocalEpoch()|date_format:"%R"}</span> {$commit->GetAuthorTimezone()}</time>)
+       (<time datetime="{$commit->GetAuthorLocalEpoch()|date_format:"%Y-%m-%dT%H:%M:%S"}{$commit->GetAuthorTimezone(true)}"><span class="latenight">{$commit->GetAuthorLocalEpoch()|date_format:"%R"}</span> {$commit->GetAuthorTimezone()}</time>)
        {else}
-       (<time datetime="{$commit->GetAuthorLocalEpoch()|date_format:"%Y-%m-%dT%H:%M:%S"}{$commit->GetAuthorTimezone()}">{$commit->GetAuthorLocalEpoch()|date_format:"%R"} {$commit->GetAuthorTimezone()}</time>)
+       (<time datetime="{$commit->GetAuthorLocalEpoch()|date_format:"%Y-%m-%dT%H:%M:%S"}{$commit->GetAuthorTimezone(true)}">{$commit->GetAuthorLocalEpoch()|date_format:"%R"} {$commit->GetAuthorTimezone()}</time>)
        {/if}
        </td>
        <td></td>
@@ -48,7 +48,7 @@
      </tr>
      <tr>
        <td></td>
-       <td> <time datetime="{$commit->GetCommitterEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+0000"}">{$commit->GetCommitterEpoch()|date_format:"%a, %d %b %Y %H:%M:%S %z"}</time> (<time datetime="{$commit->GetCommitterLocalEpoch()|date_format:"%Y-%m-%dT%H:%M:%S"}{$commit->GetCommitterTimezone()}">{$commit->GetCommitterLocalEpoch()|date_format:"%R"} {$commit->GetCommitterTimezone()}</time>)</td>
+       <td> <time datetime="{$commit->GetCommitterEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+00:00"}">{$commit->GetCommitterEpoch()|date_format:"%a, %d %b %Y %H:%M:%S %z"}</time> (<time datetime="{$commit->GetCommitterLocalEpoch()|date_format:"%Y-%m-%dT%H:%M:%S"}{$commit->GetCommitterTimezone(true)}">{$commit->GetCommitterLocalEpoch()|date_format:"%R"} {$commit->GetCommitterTimezone()}</time>)</td>
        <td></td>
      </tr>
      <tr>

--- a/templates/committip.tpl
+++ b/templates/committip.tpl
@@ -6,9 +6,9 @@
  *  Copyright (C) 2010 Christopher Han <xiphux@gmail.com>
  *}
 <div>
-{t}author{/t}: {$commit->GetAuthorName()} (<time datetime="{$commit->GetAuthorEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+0000"}">{$commit->GetAuthorEpoch()|date_format:"%Y-%m-%d %H:%M:%S"}</time>)
+{t}author{/t}: {$commit->GetAuthorName()} (<time datetime="{$commit->GetAuthorEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+00:00"}">{$commit->GetAuthorEpoch()|date_format:"%Y-%m-%d %H:%M:%S"}</time>)
 <br />
-{t}committer{/t}: {$commit->GetCommitterName()} (<time datetime="{$commit->GetCommitterEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+0000"}">{$commit->GetCommitterEpoch()|date_format:"%Y-%m-%d %H:%M:%S"}</time>)
+{t}committer{/t}: {$commit->GetCommitterName()} (<time datetime="{$commit->GetCommitterEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+00:00"}">{$commit->GetCommitterEpoch()|date_format:"%Y-%m-%d %H:%M:%S"}</time>)
 <br /><br />
 {foreach from=$commit->GetComment() item=line}
 {if strncasecmp(trim($line),'Signed-off-by:',14) == 0}

--- a/templates/headlist.tpl
+++ b/templates/headlist.tpl
@@ -14,7 +14,7 @@
    {foreach from=$headlist item=head name=heads}
        {assign var=headcommit value=$head->GetCommit()}
        <tr class="{cycle values="light,dark"}">
-         <td><em><time datetime="{$headcommit->GetCommitterEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+0000"}">{agestring age=$headcommit->GetAge()}</time></em></td>
+         <td><em><time datetime="{$headcommit->GetCommitterEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+00:00"}">{agestring age=$headcommit->GetAge()}</time></em></td>
          <td><a href="{if $router->GetCleanUrl()}{geturl project=$project action=heads hash=$head->GetName()}{else}{geturl project=$project action=shortlog hash=$head}{/if}" class="list"><strong>{$head->GetName()}</strong></a></td>
          <td class="link"><a href="{geturl project=$project action=shortlog hash=$head}">{t}shortlog{/t}</a> | <a href="{geturl project=$project action=log hash=$head}">{t}log{/t}</a> | <a href="{geturl project=$project action=tree hashbase=$headcommit}">{t}tree{/t}</a></td>
        </tr>

--- a/templates/history.tpl
+++ b/templates/history.tpl
@@ -50,7 +50,7 @@
    {foreach from=$history item=historyitem}
      {assign var=historycommit value=$historyitem->GetCommit()}
      <tr class="{cycle values="light,dark"}">
-       <td title="{if $historycommit->GetAge() > 60*60*24*7*2}{agestring age=$historycommit->GetAge()}{else}{$historycommit->GetCommitterEpoch()|date_format:"%Y-%m-%d"}{/if}"><em><time datetime="{$historycommit->GetCommitterEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+0000"}">{if $historycommit->GetAge() > 60*60*24*7*2}{$historycommit->GetCommitterEpoch()|date_format:"%Y-%m-%d"}{else}{agestring age=$historycommit->GetAge()}{/if}</time></em></td>
+       <td title="{if $historycommit->GetAge() > 60*60*24*7*2}{agestring age=$historycommit->GetAge()}{else}{$historycommit->GetCommitterEpoch()|date_format:"%Y-%m-%d"}{/if}"><em><time datetime="{$historycommit->GetCommitterEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+00:00"}">{if $historycommit->GetAge() > 60*60*24*7*2}{$historycommit->GetCommitterEpoch()|date_format:"%Y-%m-%d"}{else}{agestring age=$historycommit->GetAge()}{/if}</time></em></td>
        <td><em>{$historycommit->GetAuthorName()}</em></td>
        <td><a href="{geturl project=$project action=commit hash=$historycommit}" class="list commitTip" {if strlen($historycommit->GetTitle()) > 50}title="{$historycommit->GetTitle()|escape}"{/if}><strong>{$historycommit->GetTitle(50)|escape:'html'}</strong></a>
        {include file='refbadges.tpl' commit=$historycommit}

--- a/templates/log.tpl
+++ b/templates/log.tpl
@@ -76,7 +76,7 @@
        {/if}
        <br />
      </div>
-     <em>{$rev->GetAuthorName()} [<time datetime="{$rev->GetAuthorEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+0000"}">{$rev->GetAuthorEpoch()|date_format:"%a, %d %b %Y %H:%M:%S %z"}</time>]</em><br />
+     <em>{$rev->GetAuthorName()} [<time datetime="{$rev->GetAuthorEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+00:00"}">{$rev->GetAuthorEpoch()|date_format:"%a, %d %b %Y %H:%M:%S %z"}</time>]</em><br />
    </div>
    <div class="log_body">
      {assign var=bugpattern value=$project->GetBugPattern()}
@@ -100,7 +100,7 @@
    <div class="page_body">
      {if $commit}
        {capture name=commitage assign=commitage}
-         <time datetime="{$commit->GetCommitterEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+0000"}">{agestring age=$commit->GetAge()}</time>
+         <time datetime="{$commit->GetCommitterEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+00:00"}">{agestring age=$commit->GetAge()}</time>
        {/capture}
        {t 1=$commitage}Last change %1{/t}
      {else}

--- a/templates/project.tpl
+++ b/templates/project.tpl
@@ -21,7 +21,7 @@
    <tr><td>{t}description{/t}</td><td>{$project->GetDescription()|escape}</td></tr>
    <tr><td>{t}owner{/t}</td><td>{$project->GetOwner()|escape:'html'}</td></tr>
    {if $head}
-   <tr><td>{t}last change{/t}</td><td><time datetime="{$head->GetCommitterEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+0000"}">{$head->GetCommitterEpoch()|date_format:"%a, %d %b %Y %H:%M:%S %z"}</time></td></tr>
+   <tr><td>{t}last change{/t}</td><td><time datetime="{$head->GetCommitterEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+00:00"}">{$head->GetCommitterEpoch()|date_format:"%a, %d %b %Y %H:%M:%S %z"}</time></td></tr>
    {/if}
    {if $project->GetCloneUrl()}
      <tr><td>{t}clone url{/t}</td><td><a href="{$project->GetCloneUrl()}" rel="nofollow">{$project->GetCloneUrl()}</a></td></tr>

--- a/templates/projectlist.tpl
+++ b/templates/projectlist.tpl
@@ -85,11 +85,11 @@
       <td class="projectAge">
         {if $projecthead}
           {if $proj->GetAge() < 7200}   {* 60*60*2, or 2 hours *}
-            <span class="agehighlight"><strong><em><time datetime="{$proj->GetEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+0000"}">{agestring age=$proj->GetAge()}</time></em></strong></span>
+            <span class="agehighlight"><strong><em><time datetime="{$proj->GetEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+00:00"}">{agestring age=$proj->GetAge()}</time></em></strong></span>
           {elseif $proj->GetAge() < 172800}   {* 60*60*24*2, or 2 days *}
-            <span class="agehighlight"><em><time datetime="{$proj->GetEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+0000"}">{agestring age=$proj->GetAge()}</time></em></span>
+            <span class="agehighlight"><em><time datetime="{$proj->GetEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+00:00"}">{agestring age=$proj->GetAge()}</time></em></span>
           {else}
-            <em><time datetime="{$proj->GetEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+0000"}">{agestring age=$proj->GetAge()}</time></em>
+            <em><time datetime="{$proj->GetEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+00:00"}">{agestring age=$proj->GetAge()}</time></em>
           {/if}
 	{else}
 	  <em class="empty">{t}No commits{/t}</em>

--- a/templates/search.tpl
+++ b/templates/search.tpl
@@ -49,7 +49,7 @@
   {* Print each match *}
   {foreach from=$results item=result}
     <tr class="{cycle values="light,dark"}">
-      <td title="{if $result->GetAge() > 60*60*24*7*2}{agestring age=$result->GetAge()}{else}{$result->GetCommitterEpoch()|date_format:"%Y-%m-%d"}{/if}"><em><time datetime="{$result->GetCommitterEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+0000"}">{if $result->GetAge() > 60*60*24*7*2}{$result->GetCommitterEpoch()|date_format:"%Y-%m-%d"}{else}{agestring age=$result->GetAge()}{/if}</time></em></td>
+      <td title="{if $result->GetAge() > 60*60*24*7*2}{agestring age=$result->GetAge()}{else}{$result->GetCommitterEpoch()|date_format:"%Y-%m-%d"}{/if}"><em><time datetime="{$result->GetCommitterEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+00:00"}">{if $result->GetAge() > 60*60*24*7*2}{$result->GetCommitterEpoch()|date_format:"%Y-%m-%d"}{else}{agestring age=$result->GetAge()}{/if}</time></em></td>
       <td>
         <em>
 	  {if $searchtype == 'author'}

--- a/templates/shortloglist.tpl
+++ b/templates/shortloglist.tpl
@@ -13,7 +13,7 @@
    {foreach from=$revlist item=rev}
      <tr class="{cycle values="light,dark"}">
        <td class="monospace">{$rev->GetHash(true)}</td>
-       <td title="{if $rev->GetAge() > 60*60*24*7*2}{agestring age=$rev->GetAge()}{else}{$rev->GetCommitterEpoch()|date_format:"%Y-%m-%d"}{/if}"><em><time datetime="{$rev->GetCommitterEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+0000"}">{if $rev->GetAge() > 60*60*24*7*2}{$rev->GetCommitterEpoch()|date_format:"%Y-%m-%d"}{else}{agestring age=$rev->GetAge()}{/if}</time></em></td>
+       <td title="{if $rev->GetAge() > 60*60*24*7*2}{agestring age=$rev->GetAge()}{else}{$rev->GetCommitterEpoch()|date_format:"%Y-%m-%d"}{/if}"><em><time datetime="{$rev->GetCommitterEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+00:00"}">{if $rev->GetAge() > 60*60*24*7*2}{$rev->GetCommitterEpoch()|date_format:"%Y-%m-%d"}{else}{agestring age=$rev->GetAge()}{/if}</time></em></td>
        <td><em>{$rev->GetAuthorName()}</em></td>
        <td>
          <a href="{geturl project=$project action=commit hash=$rev}" class="list commitTip" {if strlen($rev->GetTitle()) > 50}title="{$rev->GetTitle()|escape}"{/if}>

--- a/templates/tag.tpl
+++ b/templates/tag.tpl
@@ -46,12 +46,12 @@
        </tr>
        <tr>
          <td></td>
-	 <td> <time datetime="{$tag->GetTaggerEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+0000"}">{$tag->GetTaggerEpoch()|date_format:"%a, %d %b %Y %H:%M:%S %z"}</time>
+	 <td> <time datetime="{$tag->GetTaggerEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+00:00"}">{$tag->GetTaggerEpoch()|date_format:"%a, %d %b %Y %H:%M:%S %z"}</time>
 	 {assign var=hourlocal value=$tag->GetTaggerLocalEpoch()|date_format:"%H"}
 	 {if $hourlocal < 6}
-	 (<time datetime="{$tag->GetTaggerLocalEpoch()|date_format:"%Y-%m-%dT%H:%M:%S"}{$tag->GetTaggerTimezone()}"><span class="latenight">{$tag->GetTaggerLocalEpoch()|date_format:"%R"}</span> {$tag->GetTaggerTimezone()}</time>)
+	 (<time datetime="{$tag->GetTaggerLocalEpoch()|date_format:"%Y-%m-%dT%H:%M:%S"}{$tag->GetTaggerTimezone(true)}"><span class="latenight">{$tag->GetTaggerLocalEpoch()|date_format:"%R"}</span> {$tag->GetTaggerTimezone()}</time>)
 	 {else}
-	 (<time datetime="{$tag->GetTaggerLocalEpoch()|date_format:"%Y-%m-%dT%H:%M:%S"}{$tag->GetTaggerTimezone()}">{$tag->GetTaggerLocalEpoch()|date_format:"%R"} {$tag->GetTaggerTimezone()}</time>)
+	 (<time datetime="{$tag->GetTaggerLocalEpoch()|date_format:"%Y-%m-%dT%H:%M:%S"}{$tag->GetTaggerTimezone(true)}">{$tag->GetTaggerLocalEpoch()|date_format:"%R"} {$tag->GetTaggerTimezone()}</time>)
 	 {/if}
          </td>
        </tr>

--- a/templates/taglist.tpl
+++ b/templates/taglist.tpl
@@ -15,7 +15,7 @@
 	   {assign var=object value=$tag->GetObject()}
 	   {assign var=tagcommit value=$tag->GetCommit()}
 	   {assign var=objtype value=$tag->GetType()}
-           <td><em>{if $tagcommit}<time datetime="{$tagcommit->GetCommitterEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+0000"}">{agestring age=$tagcommit->GetAge()}</time>{else}<time datetime="{$tag->GetTaggerEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+0000"}">{agestring age=$tag->GetAge()}</time>{/if}</em></td>
+           <td><em>{if $tagcommit}<time datetime="{$tagcommit->GetCommitterEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+00:00"}">{agestring age=$tagcommit->GetAge()}</time>{else}<time datetime="{$tag->GetTaggerEpoch()|date_format:"%Y-%m-%dT%H:%M:%S+00:00"}">{agestring age=$tag->GetAge()}</time>{/if}</em></td>
            <td>
 	   {if $objtype == 'commit'}
 		   <a href="{geturl project=$project action=commit hash=$object}" class="list"><strong>{$tag->GetName()}</strong></a>

comments