Skip to content

Commit

Permalink
fixed isNew getter
Browse files Browse the repository at this point in the history
  • Loading branch information
zotya committed Mar 8, 2023
1 parent a71c20b commit a94f081
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion searchlib/lib/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,11 @@ export class ResultModel extends BasicModel {
}

get isNew() {
return this.daysSinceIssued < 30;
const raw = this._result['issued']?.raw;
const issued = raw ? DateTime.fromISO(raw) : DateTime.local();
const res = DateTime.local().diff(issued, 'days').as('days');

return res < 30;
}

get issued() {
Expand Down

0 comments on commit a94f081

Please sign in to comment.