[threeten-dev] #251: Add atEndOfMonth() to YearMonth

Michael Nascimento misterm at gmail.com
Fri Feb 1 09:47:17 PST 2013


Hi guys,

In the absense of a working webrev, this is the proposed
implementation of this issue:

    //-----------------------------------------------------------------------
    /**
     * Combines this year-month with the last valid day of this
year-month to create a {@code LocalDate}.
     * <p>
     * This method can be used as part of a chain to produce a date:
     * <pre>
     *  LocalDate date = year.atMonth(month).atEndOfMonth();
     * </pre>
     *
     * @return the date formed from this year-month and the last valid
day of this year-month, not null
     */
    public LocalDate atEndOfMonth() {
        return LocalDate.of(year, month, lengthOfMonth());
    }

I will write the tests when I get them to run in my hacked OpenJDK (sigh).

Regards,
Michael


More information about the threeten-dev mailing list