Skip to content

Commit

Permalink
Make sure lastReadTimestamp is in UTC
Browse files Browse the repository at this point in the history
  • Loading branch information
puneetlath committed Dec 12, 2022
1 parent 9b5e726 commit b85a5f7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/libs/actions/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -698,18 +698,18 @@ function readNewestAction(reportID, created) {
*/
function markCommentAsUnread(reportID, created) {
// We subtract 1 millisecond so that the lastRead is updated to just before this reportAction's created date
const lastRead = DateUtils.getDBTime(new Date(created) - 1);
const lastReadTimestamp = Date.parse(`${created} UTC`) - 1;
API.write('MarkAsUnread',
{
reportID,
created: lastRead,
created: DateUtils.getDBTime(lastReadTimestamp),
},
{
optimisticData: [{
onyxMethod: CONST.ONYX.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
value: {
lastReadTimestamp: Date.parse(lastRead),
lastReadTimestamp,
},
}],
});
Expand Down

0 comments on commit b85a5f7

Please sign in to comment.