class QuarterlyPeriodType extends CalendarPeriodType {

    @Override
    public Period createPeriod( DateTimeUnit dateTimeUnit, Calendar calendar )
    {
        DateTimeUnit start = new DateTimeUnit( dateTimeUnit );

        start.setMonth( ((dateTimeUnit.getMonth() - 1) - ((dateTimeUnit.getMonth() - 1) % 3)) + 1 );
        start.setDay( 1 );

        if ( start.getMonth() > 12 )
        {
            start.setYear( start.getYear() + 1 );
            start.setMonth( 1 );
        }

        DateTimeUnit end = new DateTimeUnit( start );
        end = calendar.plusMonths( end, 2 );
        end.setDay( calendar.daysInMonth( end.getYear(), end.getMonth() ) );

        return toIsoPeriod( start, end, calendar );
    }

}