title: TypeORM Timestamp Date equality not working
body: <p>I'm using TypeORM with an Entity that looks something like this:</p>
  <pre class="lang-js prettyprint-override"><code>@Entity('users')
  export class UserEntity extends BaseEntity {
    @PrimaryColumn()
    id: string;
  
    @CreateDateColumn({ type: 'timestamp' })
    createdAt: Date;
  
    @UpdateDateColumn({ type: 'timestamp' })
    updatedAt: Date;
  }
  </code></pre>
  <p>However, when I try to do any sort of <code>timestamp</code> equality related SQL query using the TypeORM Entity's repository it does not work properly. For example the query:</p>
  <pre class="lang-js prettyprint-override"><code>const id = 'dbe9e81d-aefa-459d-8460-707ade0fa156';
  const userEntity = userRepository.findOne(id); // UserEntity(...)
  const sameUserEntity = userRepository.findOne({ where: { createdAt: userEntity.createdAt } }); // undefined
  </code></pre>
  <p>Returns the correct entity for <code>userEntity</code> and undefined for <code>sameUserEntity</code>. I looked at the logs constructed by TypeORM for this query and it looks like this:</p>
  <pre class="lang-sql prettyprint-override"><code>SELECT &quot;UserEntity&quot;.&quot;id&quot; AS &quot;UserEntity_id&quot;, 
      &quot;UserEntity&quot;.&quot;created_at&quot; AS &quot;UserEntity_created_at&quot;,
      &quot;UserEntity&quot;.&quot;updated_at&quot; AS &quot;UserEntity_updated_at&quot; 
  FROM &quot;users&quot; &quot;UserEntity&quot;
  WHERE &quot;UserEntity&quot;.&quot;created_at&quot; = $1 LIMIT 1 -- PARAMETERS: [&quot;2022-02-19T22:10:13.564Z&quot;]
  </code></pre>
  <p>It seems like TypeORM is not converting the JavaScript <code>Date</code> object to the correct PostgreSQL <code>timestamp</code> format. The timestamp in the database looks like <code>2022-02-19 22:10:13.564432</code>, which is a completely different format and is a higher precision.</p>
  <p>Is there a specific way I should be doing <code>timestamp</code> related searches when using TypeORM?</p>
  <p>Note: I've tried too look for people having this same issue but I do not see any clear solution. I'm trying to implement cursor based pagination around the created at date, however the greater than and less than operators are not work properly as well.</p>