Added method to compare two dates by their components.