Skip to content

Commit

Permalink
fix: use BigInt when calculating nanos in Timestamp.fromMillis() (#1468)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Chen committed Apr 12, 2021
1 parent db989fc commit cf1949f
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions dev/src/timestamp.ts
Expand Up @@ -107,9 +107,7 @@ export class Timestamp implements firestore.Timestamp {
*/
static fromMillis(milliseconds: number): Timestamp {
const seconds = Math.floor(milliseconds / 1000);
const nanos = Math.floor(
milliseconds * MS_TO_NANOS - seconds * 1000 * MS_TO_NANOS
);
const nanos = Math.floor((milliseconds - seconds * 1000) * MS_TO_NANOS);
return new Timestamp(seconds, nanos);
}

Expand Down

0 comments on commit cf1949f

Please sign in to comment.