This is not a bug, however it is confusing.

YearMonthDay does exactly what it says - it holds a Year, Month and Day field internally, and only allows operations on those three fields. As a result, adding a week has no effect, as weeks are an ignored field.

For the next release, v1.3, there will be a new class, LocalDate, which will behave as you expect.

Stephen

On 30/05/06, Richardson, James <[EMAIL PROTECTED]> wrote:

This doesn't output the result I expected:

    public static void main(String[] args) {

        YearMonthDay ymd = new YearMonthDay(2006,5,23);
        DateMidnight dt = ymd.toDateMidnight();
        Period p = new Period(0, 0, 2, 0, 0, 0, 0, 0);
        System.out.println(dt.plus(p));
        System.out.println(ymd.plus(p));
    }

Change the period to use any other field and it will work, just not weeks.

This seems to be a bug?

Cheers

James





--------------------------------------------------------------------------------
The information contained herein is confidential and is intended solely for the
addressee. Access by any other party is unauthorised without the express
written permission of the sender. If you are not the intended recipient, please
contact the sender either via the company switchboard on +44 (0)20 7623 8000, or
via e-mail return. If you have received this e-mail in error or wish to read our
e-mail disclaimer statement and monitoring policy, please refer to
http://www.drkw.com/disc/email/ or contact the sender.
--------------------------------------------------------------------------------



-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
Joda-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/joda-interest

Reply via email to