problems creating a new duration with date.js
Elisabeth Baute <[email protected]>
| Newsgroups | gmane.text.xml.xslt.extensions |
|---|---|
| Message-ID | <[email protected]> |
I have had to change the date.js function Duration
from:
this.milliseconds = eval('0.'+fraction) * 100;
to:
this.milliseconds = eval(0.+fraction) * 100;
Has anyone experienced this?
I also found the following mail on the exslt list. I think I am missing
the fixes Jeni mentions in point 1. I downloaded date.js alone and as
part of the date-time package. Both have the same implementation. Both
produce NaN durations in _validDuration.
My test call is:
<xsl:variable name="sec_display"
select="date:add('1970-01-01T00:00:00', 'P12342DT18H36M5S')"/>
When I comment out the original:
return new Duration(parts[1], parts[3], parts[5], parts[7], parts[11],
parts[13], parts[16], parts[18]);
And substitute it with
return new Duration(1, 2, 3, 4, 5, 6, 7, 8);
I get a valid duration created.
1973-05-06T06:07:08+04:00
The original code produces
NaN-NaN-NaNTNaN:NaN:NaN+NaN:NaN
Does any of this sound familiar? Is this the problem that was fixed?
Thank you,
Elisabeth Baute
============================================================
[exslt] date/time functions
Jeni Tennison Jeni Tennison <[email protected]>
Fri, 22 Mar 2002 11:53:59 +0000
Previous message: [exslt] very low priority - date:add 'billionthSecBug'
Next message: [exslt] Xalan-Java adds EXLST extensions
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
--------------------------------------------------------------------------------
Hi,
Thanks for sending all those bugs in the date/time functions and
prompting me to fix them. For the record, I've:
1. Fixed date.js/date.msxml.xsl:
- _formatDate() thanks to Bruce Rindahl
- parseDate() thanks to Bruce Rindahl
- _validDuration() thanks to Bruce Krautbauer
2. Fixed the bug in date.add.template.xsl/date.add.function.xsl
reported by Bruce Krautbauer, about adding negative durations (or
at least that particular instance...)
3. Fixed the bug in date.add.template.xsl/date.add.function.xsl
reported by Bruce Krautbauer, about adding billionths of seconds in
durations. I think that this one is due to some kind of strange
floating arithmetic thing - try doing 0.0000001 + 0.000000001 and
you come out with 0.0000001009999999999999999 rather than
0.000000101 as you'd expect. But I've now got it reporting
...T00:00:00.000000100999999999999999 rather than
...T00:00:00.000000100, which is probably better.
The fixes are currently being uploaded.
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com