code: public function encode($value, Field $field, Codec $codec = null)
      {
          if ($value instanceof \DateTimeInterface) {
              return $value->format('Y-m-d');
          }
  
          return null;
      }
docs: {@inheritdoc}