java - Joda-Time ISO8601 standard ISOPeriodFormat cannot parse decimal fraction -
as stated in iso8601 wikipedia article :
the smallest value used may have decimal fraction, in "p0.5y" indicate half year. decimal fraction may specified either comma or full stop, in "p0,5y" or "p0.5y".
but can't parse such period joda-time, following code :
period.parse("p0.5y", isoperiodformat.standard());
fails :
java.lang.illegalargumentexception: invalid format: "p0.5y" malformed @ "0.5y"
who's wrong : wikipedia, joda-time isoperiodformat.standard() or mistake?
with jodatime 2.2
it looks limitation of jodatime. has isoperiodformat , periodformatterbuilder creating periodformatters. isoperiodformat supports subset of iso8601 formats (none including fractional years) per link in comments. periodformatbuilder, although highly configurable, apparently deal years integers :
http://joda-time.sourceforge.net/apidocs/org/joda/time/format/periodformatterbuilder.html
Comments
Post a Comment