TradingWeekImpl extends JodaWorkingWeek implements TradingWeek { @Override public int getTradingDaysInMonth(DateTime dt) { dt = getSessionTradingDate(dt.dayOfMonth().withMinimumValue()); int month = dt.getMonthOfYear(); int sessionIdx = sessions.indexOf(getTradingSessionOnOrAfter(dt)); int prevday = 0; int nextday = 0; int days = 0; int sessionLen = sessions.size(); DateTime workingDate = new DateTime(dt); int tradingDayCount = 0; while(workingDate.getMonthOfYear() == month) { do { prevday = sessions.get(sessionIdx).day(); if(++sessionIdx == sessionLen) { sessionIdx = 0; } nextday = sessions.get(sessionIdx).day(); days += naturalDaysBetween(prevday, nextday); workingDate = dt.plusDays(days); } while(calculator.isNonWorkingDay(workingDate.toLocalDate()) && workingDate.getMonthOfYear() == month); ++tradingDayCount; } return tradingDayCount; } private  TradingWeekImpl(byte tradingDays); static Builder configBuilder(
        String propertiesFilePath, String calendarName, String tradingWeekName); static Builder configBuilder(
        Properties properties, String calendarName, String tradingWeekName); @Override int length(); @Override void addTradingSession(TradingSession session); @Override TradingSession getStartSession(); @Override TradingSession getEndSession(); @Override int getTradingDaysInMonth(DateTime dt); @Override boolean isTradingDay(DateTime dt); @Override DateTime getSessionTradingDate(DateTime dt); @Override long getWeekMillis(); @Override long getSessionMillisBetween(DateTime dt1, DateTime dt2); TradingSession getTradingSessionOnOrBefore(DateTime date); @Override DateTime getPreviousSessionDate(DateTime dt, Period period); @Override TradingSession getTradingSessionOnOrAfter(DateTime date); @Override DateTime getNextSessionDate(DateTime dt, Period period); static TradingWeek loadDefaultTradingWeek(); @Override boolean isWorkingDay(LocalDate date); static int naturalDaysBetween(int startDay, int endDay); static String dayToString(int day); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); static final TradingWeek DEFAULT; }
@Test public void testGetTradingDaysInMonth() { TradingWeek week = getTestTradingWeek(TEST3); DateTime dt1 = new DateTime(2009, 10, 11, 8, 30, 0, 0); assertEquals(13, week.getTradingDaysInMonth(dt1)); }