Hi,

since I need our SMW to output ISO8601 date output (see [1]) I wrote a quick patch to SMW_DV_Time.php that honours the (newly introduced) $smwgISO8601DateOutput variable.

Could something like this be included in SMW?

Patrick.

[1]: http://sourceforge.net/mailarchive/forum.php?thread_name=49A223B5.1090608%40patrick-nagel.net&forum_name=semediawiki-user

--
Key ID: 0x86E346D4            http://patrick-nagel.net/key.asc
Fingerprint: 7745 E1BE FA8B FBAD 76AB 2BFC C981 E686 86E3 46D4
--- SMW_DV_Time.php.original	2009-03-04 18:13:46.000000000 +0800
+++ SMW_DV_Time.php	2009-03-04 18:07:15.000000000 +0800
@@ -404,7 +404,7 @@
 	 * from the store.
 	 */
 	protected function makePrintoutValue() {
-		global $smwgContLang;
+		global $smwgContLang, $smwgISO8601DateOutput;
 		if ($this->m_printvalue === false) {
 			//MediaWiki date function is not applicable any more (no support for BC Dates)
 			if ($this->m_year > 0) {
@@ -413,10 +413,18 @@
 				$this->m_printvalue = number_format(-($this->m_year-1), 0, '.', '') . ' BC'; // note: there should be no digits after the comma anyway
 			}
 			if ($this->m_month) {
-				$this->m_printvalue =  $smwgContLang->getMonthLabel($this->m_month) . " " . $this->m_printvalue;
+				if($smwgISO8601DateOutput === false) {
+					$this->m_printvalue =  $smwgContLang->getMonthLabel($this->m_month) . " " . $this->m_printvalue;
+				} else {
+					$this->m_printvalue =  $this->m_printvalue . '-' . str_pad($this->m_month, 2, "0", STR_PAD_LEFT);
+				}
 			}
 			if ($this->m_day) {
-				$this->m_printvalue =  $this->m_day . " " . $this->m_printvalue;
+				if($smwgISO8601DateOutput === false) {
+					$this->m_printvalue =  $this->m_day . " " . $this->m_printvalue;
+				} else {
+					$this->m_printvalue =  $this->m_printvalue . '-' . str_pad($this->m_day, 2, "0", STR_PAD_LEFT);
+				}
 			}
 			if ($this->m_time) {
 				$this->m_printvalue .= " " . $this->m_time;
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel

Reply via email to