Skip to content

Commit

Permalink
dev: fix a timestamp bug in old name expiry
Browse files Browse the repository at this point in the history
  • Loading branch information
KernelDeimos committed Dec 19, 2024
1 parent 6d2966f commit 0d53020
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/backend/src/services/OldAppNameService.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,20 @@ class OldAppNameService extends BaseService {

// Check if the app has been renamed in the last N months
const [row] = rows;
const timestamp = new Date(row.timestamp);
const timestamp = new Date(
// Ensure timestamp ir processed as UTC
row.timestamp.endsWith('Z') ? row.timestamp : row.timestamp + 'Z'
);

const age = Date.now() - timestamp.getTime();

const n_ms = N_MONTHS * 30 * 24 * 60 * 60 * 1000
const n_ms = 60 * 1000;
// const n_ms = N_MONTHS * 30 * 24 * 60 * 60 * 1000
this.log.noticeme('AGE INFO', {
input_time: row.timestamp,
age,
n_ms,
});
if ( age > n_ms ) {
// Remove record
await this.db.write(
Expand Down

0 comments on commit 0d53020

Please sign in to comment.