Skip to content

Commit

Permalink
chore: replace future dates in vostanimez crawler with current date
Browse files Browse the repository at this point in the history
  • Loading branch information
AXeL-dev committed Feb 22, 2022
1 parent cc79a63 commit 99f8dc1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/app/crawlers/vostfr/vostanimez.crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { LatestEpisodesCrawler } from '../abstract/latest-episodes.crawler';
import { ScraperService } from '../../services/scraper.service';
import { Episode } from '../../models/episode';
import { Observable } from 'rxjs';
import { now } from 'src/app/helpers/date.helper';

export class VostAnimezCrawler extends LatestEpisodesCrawler {
constructor(private scraper: ScraperService) {
Expand All @@ -20,7 +21,9 @@ export class VostAnimezCrawler extends LatestEpisodesCrawler {
return sub?.length ? sub[2].toLowerCase() : 'vostfr';
},
date: (text: string) => {
return new Date(text)?.getTime();
const date = new Date(text)?.getTime();
const currentDate = now().getTime();
return date > currentDate ? currentDate : date;
},
};
}
Expand Down

0 comments on commit 99f8dc1

Please sign in to comment.