Am 06.12.2019 um 11:32 schrieb Martin Honnen:
Am 06.12.2019 um 11:23 schrieb France Baril:


The following function returns P4511D: 0 but I expect P4511D: 12
Bug or bad usage?

let $d1 := xs:date('2007-07-31')
let $d2 := xs:date('2019-12-06')
let $duration := $d2 - $d1
let $years := years-from-duration($duration)
return $duration || ': ' || $years


The spec https://www.w3.org/TR/xpath-functions/#func-years-from-duration says "If $arg is an xs:dayTimeDuration the function returns 0.".


As a workaround, see https://www.oxygenxml.com/archives/xsl-list/200601/msg00446.html which tries to compute the years from the dayTimeDuration.