After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 635238 - Related to EXSLT date:add( )
Related to EXSLT date:add( )
Status: RESOLVED FIXED
Product: libxslt
Classification: Platform
Component: general
unspecified
Other Windows
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2010-11-19 05:24 UTC by mcseshu
Modified: 2012-09-04 08:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to this bug. (618 bytes, patch)
2010-11-19 05:26 UTC, mcseshu
none Details | Review

Description mcseshu 2010-11-19 05:24:08 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
Comment 1 mcseshu 2010-11-19 05:26:37 UTC
Created attachment 174821 [details] [review]
Patch to this bug.
Comment 2 Daniel Veillard 2012-09-04 08:58:52 UTC
Fixed in git last year:

http://git.gnome.org/browse/libxslt/commit/?id=4e9909066731067d8e256ca25d8d54944105bc5e

 thanks !

Daniel