Issues with server side pagination of Firestore

This solution works perfectly but requires changing the line
let createdAtValue = values[TIMESTAMP_KEY];
to
let createdAtValue = values[TIMESTAMP_KEY].seconds * 1000;

Otherwise, getting dates like 1970-01-20T21:42:46.351Z.

Listing:

const TIMESTAMP_KEY = "created_at"
const data = []

await db
  .firestore()
  .collection("users")
  .orderBy(TIMESTAMP_KEY, "desc")
  .limit(table1.pagination.pageSize || 27)
  .offset(table1.pagination.currentPage * 27)
  .get()
  .then((querySnapshot) => {
    querySnapshot.forEach((doc) => {
      const values = doc.data();
      let createdAtValue = values[TIMESTAMP_KEY].seconds * 1000;

      createdAtValue = new Date(createdAtValue);
      
      data.push({
        ...values,
        [TIMESTAMP_KEY]: createdAtValue,
      });
    });
  });

return data;