class DefectService {

    boolean areEqualDownToSeconds(Date date1, Date date2) {
        final boolean bothNull = (date1 == null && date2 == null);
        final boolean bothNotNull = (date1 != null && date2 != null);
        return bothNull || (bothNotNull && (date1.getTime() / 1000) == (date2.getTime() / 1000));
    }

}