class_docstr: Check test data that is dated earlier than the latest date in train.
  
  Parameters
  ----------
  n_samples : int , default: 1_000_000
      number of samples to use for this check.
  random_state : int, default: 42
      random seed for all check internals.
docstr: Run check.
  
  Returns
  -------
  CheckResult
      value is the ratio of date leakage.
      data is html display of the checks' textual result.
  
  Raises
  ------
  DeepchecksValueError
      If one of the datasets is not a Dataset instance with an date
docstr_tok: ["Run","check",".","Returns","--","--","--","-","CheckResult","value","is","the","ratio","of","date","leakage",".","data","is","html","display","of","the","checks","'","textual","result",".","Raises","--","--","--","DeepchecksValueError","If","one","of","the","datasets","is","not","a","Dataset","instance","with","an","date"]
code: def run_logic(self, context: Context) -> CheckResult:
      """Run check.
  
      Returns
      -------
      CheckResult
          value is the ratio of date leakage.
          data is html display of the checks' textual result.
  
      Raises
      ------
      DeepchecksValueError
          If one of the datasets is not a Dataset instance with an date
      """
      train_dataset = context.train.sample(
          self.n_samples, random_state=self.random_state
      )
      test_dataset = context.test.sample(
          self.n_samples, random_state=self.random_state
      )
  
      train_dataset.assert_datetime()
      train_date = train_dataset.datetime_col
      test_date = test_dataset.datetime_col
  
      max_train_date = max(train_date)
      min_test_date = min(test_date)
      dates_leaked = sum(date < max_train_date for date in test_date)
  
      if dates_leaked > 0:
          leakage_ratio = dates_leaked / test_dataset.n_samples
          return_value = leakage_ratio
          display = (
              f"{format_percent(leakage_ratio)} of test data samples are in the date range "
              f"{format_datetime(min_test_date)} - {format_datetime(max_train_date)}"
              f", which occurs before last training data date ({format_datetime(max_train_date)})"
          )
      else:
          display = None
          return_value = 0
  
      return CheckResult(
          value=return_value,
          header="Date Train-Test Leakage (overlap)",
          display=display,
      )
  
file_path: deepchecks/deepchecks/tabular/checks/train_test_validation/date_train_test_leakage_overlap.py
imports: from deepchecks.core import CheckResult, ConditionCategory, ConditionResult
  from deepchecks.tabular import Context, TrainTestCheck
  from deepchecks.utils.strings import format_datetime, format_percent
label_desc: Use image node_id 2 for calling the DateTrainTestLeakageOverlap obj's underlying member method code with example usage: obj.run_logic(context) and returns: CheckResult