Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private static boolean isValidChecksum(final String rrn) {
private static boolean isValidDate(final String rrn) {
final int month = extractMonth( rrn );
final int day = extractDay( rrn );
if ( month > 12 || day < 0 || day > 31 ) {
if ( month < 1 || month > 12 || day < 1 || day > 31 ) {
return false;
}
return day <= 31 && ( day <= 30 || ( month != 4 && month != 6 && month != 9 && month != 11 ) ) && ( day <= 29 || month != 2 );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ void testNeverAttrWithoutHyphen() {
void invalidDate() {
assertInvalidRRN( "861324-2567481" );
assertInvalidRRN( "960292-2499371" );
assertInvalidRRN( "000001-1234560" );
assertInvalidRRN( "000100-1234560" );
assertInvalidRRN( "000000-1234560" );
}

// Invalid RRN Length
Expand Down