[xslt] Bug report: Related to EXSLT date:add( )



 
Hi,
             
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
 
 

Attachment: date.diff
Description: Binary data



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]