kossnocorp / typesaurus

🦕 Type-safe TypeScript-first ODM for Firestore
https://typesaurus.com
412 stars 34 forks source link

Manual Timestamps are being changed #105

Closed SrBrahma closed 3 months ago

SrBrahma commented 2 years ago

Example:

await set(users, 'a', {
  a: new Date(0),
  b: firebase.firestore.Timestamp.fromDate(new Date(0)),
} as any);
await db.doc('users/b').set({ c: firebase.firestore.Timestamp.fromDate(new Date(0)) });

image image

It's not trivial. It's not allowing my query that compares Date to work, ex where('myField', '>', new Date(0)),. The query doesn't work in the {_seconds} object, only when it's a proper Timestamp.

Using v8 version.

I am out of time currently, I will try to quickly fix it and make a PR if I can do it.

SrBrahma commented 2 years ago

I though it was an Emulator issue: https://github.com/firebase/firebase-tools/issues/3900

KoreanThinker commented 2 years ago

@SrBrahma is there a temporary solution??

SrBrahma commented 2 years ago

@SrBrahma is there a temporary solution??

Yes! I have made some PRs for this and other bugs. While they are not accepted, you can use them via npm i typesaurus@srbrahma/typesaurus#lib IIRC. If the command is wrong, just Google 'npm/yarn install fork'

It's source is https://github.com/SrBrahma/typesaurus/tree/v8, using the branch v8 of typesaurus, a branch that is better than the master one.

kossnocorp commented 3 months ago

I don't think it's relevant, but if it does please open a new issue with more details