Skip to content

Commit

Permalink
fix campaign availability (#526)
Browse files Browse the repository at this point in the history
fix campaign availability
  • Loading branch information
raniamorheg authored Sep 15, 2023
1 parent 6044a79 commit 7c6e9e6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ <h3 class="success-title mt-2">{{ 'campaign_success' | translate }}</h3>
<strong
>{{ 'campaign_validation.description1' | translate }}
<span
>{{ convertUnixToDate(calculateStartDate()) | date: 'HH:mm' }}
>{{ convertUnixToDate(calculateStartDate(this.campaign.updatedAt)) | date: 'HH:mm' }}
</span>
</strong>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export class PasswordModalComponent implements OnInit {
}

// A ne pas changer +60 Minute
_campaign.startDate = this.calculateStartDate();
_campaign.startDate = this.calculateStartDate(this.campaign?.updatedAt);

_campaign.endDate = Math.floor(this.campaign.endDate.getTime() / 1000);

Expand All @@ -211,17 +211,18 @@ export class PasswordModalComponent implements OnInit {
}
}

calculateStartDate() {
let date = new Date();
let dateInSeconds = new Date(date);

calculateStartDate(startDate: any) {


let date = new Date(startDate);

date.setMinutes(date.getMinutes() + 60);
dateInSeconds.setMinutes(date.getMinutes() + 60);
date.setSeconds(0);
dateInSeconds.setSeconds(0);

date.setMinutes(date.getMinutes() + 60);
date.setSeconds(0);
let dateInSeconds = Math.floor(date.getTime() / 1000);

return dateInSeconds;

}

parentFunction() {
Expand Down Expand Up @@ -575,8 +576,8 @@ export class PasswordModalComponent implements OnInit {
// Common logic for launching campaigns, handles date conversion and common actions.
private commonCampaignLogic(campaign_info: any, createCampaign: boolean): Observable<any> {
// Convert the start date to Unix timestamp
const startDateUnix = Math.floor(campaign_info.startDate.getTime() / 1000);
campaign_info.startDate = startDateUnix;
// const startDateUnix = Math.floor(campaign_info.startDate.getTime() / 1000);
// campaign_info.startDate = startDateUnix;

if (campaign_info.currency === 'BNB') {
campaign_info.tokenAddress = null;
Expand Down

0 comments on commit 7c6e9e6

Please sign in to comment.