Skip to content

Commit

Permalink
fix: changed discount scraper default start date (#850)
Browse files Browse the repository at this point in the history
Fixes: #839 
Fix default start date of discount (and mercantile) scrapers.

The previous default date `moment().subtract(1, 'years').add(1, 'day').toDate()` would return the following error:

```
Error: GENERIC - כרגע לא ניתן להציג את המידע. אפשר לנסות שוב מאוחר יותר או לפנות למוקד התמיכה בטלפון: 03-9439191 ובטלבנק 6111*
```
changing the default start date to `moment().subtract(1, 'years').add(2, 'day').toDate()` avoids this error
  • Loading branch information
EzzatQ committed Apr 2, 2024
1 parent c873557 commit bc02d91
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/scrapers/discount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ async function fetchAccountData(page: Page, options: ScraperOptions): Promise<Sc
}
const accountNumber = accountInfo.UserAccountsData.DefaultAccountNumber;

const defaultStartMoment = moment().subtract(1, 'years').add(1, 'day');
const defaultStartMoment = moment().subtract(1, 'years').add(2, 'day');
const startDate = options.startDate || defaultStartMoment.toDate();
const startMoment = moment.max(defaultStartMoment, moment(startDate));

Expand Down

0 comments on commit bc02d91

Please sign in to comment.