FR: Add valueOf() to Timestamp instances (original) (raw)

[REQUIRED] Describe your environment

[REQUIRED] Describe the problem

Unable to compare Timestamp instances with native comparators. Javascript calls valueOf() on the object and uses the results of that to do native comparisons.

Steps to reproduce:

Attempt to compare Timestamps directly.

Relevant Code:

firebase = require('firebase-admin') a = new firebase.firestore.Timestamp(1, 1) b = new firebase.firestore.Timestamp(2, 2) console.log(a < b) // false console.log(b < a) // false

Workaround

Of course you can simply call toMillis() and compare those, but having it auto handled would be better.