Skip to content

Commit

Permalink
fix: try if this utc time works for all
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashutosh00710 committed May 19, 2024
1 parent d04593b commit f4ed6ed
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@ export class Fetcher {
let from = '',
to = '';
if (customFromDate && customToDate) {
from = customFromDate;
to = moment(customToDate).add(2, 'days').utc().toISOString();
days += 1;
from = moment(customFromDate).add(1, 'days').utc().toISOString(true);
to = moment(customToDate).add(2, 'days').utc().toISOString(true);
} else {
const now = moment();
from = moment(now).subtract(days, 'days').utc().toISOString();
Expand Down Expand Up @@ -90,12 +89,13 @@ export class Fetcher {
// either the day hasn't really started
// or the user hasn't contributed today
const length = userData.contributions.length;

if (userData.contributions[length - 1].contributionCount === 0) {
userData.contributions.pop();
}
const extra = userData.contributions.length - days;
userData.contributions.splice(0, extra);
if (!(customFromDate && customToDate)) {
const extra = userData.contributions.length - days;
userData.contributions.splice(0, extra);
}
return userData;
}
} catch (error) {
Expand Down

0 comments on commit f4ed6ed

Please sign in to comment.