GNOME Bugzilla – Bug 635238
Related to EXSLT date:add( )
Last modified: 2012-09-04 08:58:52 UTC
Problem description: EXSLT date:add() adds days to xs:gYearMonth/xs:gYear incorrectly when month is January The following 2 expressions returns incorrect date: <xsl:value-of select="date:add( "2001-01", "P3D" )" /> -> returns 2001-01 <xsl:value-of select="date:add( "2001", "P12D" )')" /> -> returns 2001 Ideally it should return "2001-01-04" and "2001-01-13" respectively. Root cause: In _exsltDateAdd(..,..) function ( libxslt/trunk/libexslt/date.c) Because the month is January(1), "if" condition will never evaluate to true, even though the day was changed , so it never returns return type as XS_DATE Patch: attached. Please provide your comments. After the patch: ---------------------- <xsl:value-of select="date:add( "2001-01", "P3D" )" /> -> returns 2001-01-04 <xsl:value-of select="date:add( "2001", "P12D" )')" /> -> returns 2001-01-13 Thanks, Satya
Created attachment 174821 [details] [review] Patch to this bug.
Fixed in git last year: http://git.gnome.org/browse/libxslt/commit/?id=4e9909066731067d8e256ca25d8d54944105bc5e thanks ! Daniel