You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: base_contract.rb
    path of file: ./repos/openproject/app/contracts/work_packages
    
    the code of the file until where you have to start completion: #-- copyright
# OpenProject is an open s
    
    def validate_duration_matches_dates
      return unless calculated_duration && model.duration

      if calculated_duration > model.duration
        errors.add :duration, :smaller_than_dates
      elsif calculated_duration < model.duration
        errors.add :duration, :larger_than_dates
      end