From 7c6e9e6787bcba8a278221692e3a4ac1bda51999 Mon Sep 17 00:00:00 2001
From: raniamorheg <45526523+raniamorheg@users.noreply.github.com>
Date: Fri, 15 Sep 2023 17:51:08 +0100
Subject: [PATCH] fix campaign availability (#526)
fix campaign availability
---
.../password-modal.component.html | 2 +-
.../password-modal.component.ts | 23 ++++++++++---------
2 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/src/app/campaigns/components/password-modal/password-modal.component.html b/src/app/campaigns/components/password-modal/password-modal.component.html
index 3207e6ef6..70835e797 100755
--- a/src/app/campaigns/components/password-modal/password-modal.component.html
+++ b/src/app/campaigns/components/password-modal/password-modal.component.html
@@ -111,7 +111,7 @@
{{ 'campaign_success' | translate }}
{{ 'campaign_validation.description1' | translate }}
{{ convertUnixToDate(calculateStartDate()) | date: 'HH:mm' }}
+ >{{ convertUnixToDate(calculateStartDate(this.campaign.updatedAt)) | date: 'HH:mm' }}
diff --git a/src/app/campaigns/components/password-modal/password-modal.component.ts b/src/app/campaigns/components/password-modal/password-modal.component.ts
index 4eab80f3a..521abdbc6 100755
--- a/src/app/campaigns/components/password-modal/password-modal.component.ts
+++ b/src/app/campaigns/components/password-modal/password-modal.component.ts
@@ -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);
@@ -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() {
@@ -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 {
// 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;