Skip to content
Permalink
Browse files

Merge pull request #266 from AnnanFay/master

Temporary date parsing fix
  • Loading branch information...
Manuel-777 committed Apr 22, 2019
2 parents 1d35450 + 018d5ee commit bfb8fc7a8498cd460131acedd1610586a883e256
Showing with 12 additions and 1 deletion.
  1. +12 −1 window_background/labels.js
@@ -407,9 +407,21 @@ function minifiedDelta(delta) {
function onLabelInventoryUpdated(entry, transaction) {
// if (!transaction) return;


// Store this in case there are any future date parsing issues
transaction.timestamp = entry.timestamp;

// Add missing data
transaction.date = parseWotcTime2(entry.timestamp);

// hacky work around until date parsing for non-english languages is fixed.
// FIXME: Sort out the parseWotcTime2 parsing
let dateIsInvalid = !transaction.date || isNaN(transaction.date.getTime());
if (dateIsInvalid) {
console.log(`Invalid date ('${entry.timestamp}') - using current date as backup.`);
transaction.date = new Date();
}

// Reduce the size for storage
transaction.delta = minifiedDelta(transaction.delta);

@@ -419,7 +431,6 @@ function onLabelInventoryUpdated(entry, transaction) {
transaction.id = sha1(milliseconds + context);

// Do not modify the context from now on.

saveEconomyTransaction(transaction);
return;
}

0 comments on commit bfb8fc7

Please sign in to comment.
You can’t perform that action at this time.