code: public Date getFinishTime(Date date)
     {
        Date result = null;
  
        if (date != null)
        {
           ProjectCalendarDateRanges ranges = getRanges(date, null, null);
           if (ranges == null)
           {
              result = getParentFile().getProjectProperties().getDefaultEndTime();
              result = DateHelper.getCanonicalTime(result);
           }
           else
           {
              Date rangeStart = result = ranges.getRange(0).getStart();
              Date rangeFinish = ranges.getRange(ranges.getRangeCount() - 1).getEnd();
              Date startDay = DateHelper.getDayStartDate(rangeStart);
              Date finishDay = DateHelper.getDayStartDate(rangeFinish);
  
              result = DateHelper.getCanonicalTime(rangeFinish);
  
              //
              // Handle the case where the end of the range is at midnight -
              // this will show up as the start and end days not matching
              //
              if (startDay != null && finishDay != null && startDay.getTime() != finishDay.getTime())
              {
                 result = DateHelper.addDays(result, 1);
              }
           }
        }
        return result;
     }
docs: Retrieves the time at which work finishes on the given date, or returns
  null if this is a non-working day.
  
  @param date Date instance
  @return finish time, or null for non-working day