Skip to content

Limit Timestamp normalization #2684

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions packages/firestore/src/model/field_value.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export class FieldValueOptions {
* Potential types returned by FieldValue.value(). This could be stricter
* (instead of using {}), but there's little benefit.
*
* Note that currently we use AnyJs (which is identical except includes
* Note that currently we use `unknown` (which is identical except includes
* undefined) for incoming user data as a convenience to the calling code (but
* we'll throw if the data contains undefined). This should probably be changed
* to use FieldType, but all consuming code will have to be updated to
Expand Down Expand Up @@ -367,6 +367,9 @@ export class TimestampValue extends FieldValue {
* localWriteTime.
*/
export class ServerTimestampValue extends FieldValue {
// TODO(mrschmidt): Represent ServerTimestamps as a PrimitiveType with a
// Map containing a private `__type__` field (or similar).

typeOrder = TypeOrder.TimestampValue;

constructor(
Expand Down Expand Up @@ -402,7 +405,7 @@ export class ServerTimestampValue extends FieldValue {
compareTo(other: FieldValue): number {
if (other instanceof ServerTimestampValue) {
return this.localWriteTime._compareTo(other.localWriteTime);
} else if (other instanceof TimestampValue) {
} else if (other.typeOrder === TypeOrder.TimestampValue) {
// Server timestamps come after all concrete timestamps.
return 1;
} else {
Expand Down
Loading