-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Closed
Labels
impact: criticalUsually a production crash with high user impact. (P1)Usually a production crash with high user impact. (P1)plugin: cloud_firestoretype: bugSomething isn't workingSomething isn't working
Description
Currently, this will throw an error:
Timestamp.fromMillisecondsSinceEpoch(-1);I suggest the above code should be add as a test to the package.
It's a simple fix. The seconds/nanoseconds calculation is wrong:
int milliseconds = -1;
var _kThousand = 1000;
var _kMillion = 1000000;
// What is should be:
int seconds = (milliseconds / _kThousand).floor();
int nanoseconds = (milliseconds - seconds * _kThousand) * _kMillion;
print('seconds = $seconds');
print('nanoseconds = $nanoseconds');
// Flutterfire's current code:
seconds = (milliseconds ~/ _kThousand).floor();
nanoseconds = (milliseconds - seconds * _kThousand) * _kMillion;
print('seconds = $seconds');
print('nanoseconds = $nanoseconds');This is the same as flutter/flutter#34929 and #1222 which was not fixed after all.
This is a serious issue with an easy fix. Please, give it a high priority and don't let it stand for long. Thanks.
yamauchieduardo and ekayy
Metadata
Metadata
Assignees
Labels
impact: criticalUsually a production crash with high user impact. (P1)Usually a production crash with high user impact. (P1)plugin: cloud_firestoretype: bugSomething isn't workingSomething isn't working