Index: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Time.php |
— | — | @@ -776,13 +776,17 @@ |
777 | 777 | * |
778 | 778 | * Conforming to the 2000 version of ISO8601, year 1 BC(E) is |
779 | 779 | * represented as "0000", year 2 BC(E) as "-0001" and so on. |
780 | | - * @param $mindefault boolean determining whether values below the precision of our input should be completed with minimal or maximal conceivable values |
| 780 | + * |
| 781 | + * @param $mindefault boolean determining whether values below the |
| 782 | + * precision of our input should be completed with minimal or maximal |
| 783 | + * conceivable values |
781 | 784 | * @return string |
782 | 785 | */ |
783 | 786 | public function getISO8601Date( $mindefault = true ) { |
784 | | - $result = ( $this->getYear() < -1 ) ? '-' : ''; |
| 787 | + $yearnum = ( $this->getYear() > 0 ) ? $this->getYear() : 1 - $this->getYear(); |
| 788 | + $result = ( $this->getYear() > 0 ) ? '' : '-'; |
785 | 789 | $monthnum = $this->getMonth( SMWDITime::CM_GREGORIAN, ( $mindefault ? 1 : 12 ) ); |
786 | | - $result .= str_pad( $this->getYear() + 1, 4, "0", STR_PAD_LEFT ) . |
| 790 | + $result .= str_pad( $this->getYear(), 4, "0", STR_PAD_LEFT ) . |
787 | 791 | '-' . str_pad( $monthnum, 2, "0", STR_PAD_LEFT ); |
788 | 792 | if ( !$mindefault && ( $this->m_dataitem->getPrecision() < SMWDITime::PREC_YMD ) ) { |
789 | 793 | $maxday = self::getDayNumberForMonth( $monthnum, $this->getYear(), SMWDITime::CM_GREGORIAN ); |