Merge pull request #133 from richard-ramos/fix/date

fix: timestamp
This commit is contained in:
fryorcraken.eth 2022-10-08 14:34:06 +11:00 committed by GitHub
commit 47ee93b7f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -379,7 +379,7 @@
const callback = (wakuMessage) => { const callback = (wakuMessage) => {
const {timestamp, nick, text} = ProtoChatMessage.decode(wakuMessage.payload) const {timestamp, nick, text} = ProtoChatMessage.decode(wakuMessage.payload)
const time = new Date(); const time = new Date();
time.setTime(Number(timestamp)); time.setTime(Number(timestamp) * 1000);
let proofState, verify; let proofState, verify;
if (typeof wakuMessage.rateLimitProof === "undefined") { if (typeof wakuMessage.rateLimitProof === "undefined") {
@ -432,7 +432,7 @@
sendButton.onclick = async () => { sendButton.onclick = async () => {
const text = utils.utf8ToBytes(textInput.value); const text = utils.utf8ToBytes(textInput.value);
const timestamp = new Date(); const timestamp = new Date();
const msg = ProtoChatMessage.create({text, nick: nicknameInput.value, timestamp: timestamp.valueOf()}); const msg = ProtoChatMessage.create({text, nick: nicknameInput.value, timestamp: Math.floor(timestamp.valueOf() / 1000)});
const payload = ProtoChatMessage.encode(msg).finish(); const payload = ProtoChatMessage.encode(msg).finish();
console.log("Sending message with proof...") console.log("Sending message with proof...")
sendingStatusSpan.innerText = 'sending...' sendingStatusSpan.innerText = 'sending...'