Skip to content
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

fix: use BigInt when calculating nanos in Timestamp.fromMillis() #1468

Merged
merged 4 commits into from Apr 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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