Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bug display countdown #753

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -286,25 +286,33 @@ export class CampaignDetailComponent implements OnInit {

setTimeout(() => {
// WHEN YOU GET REFUNDS ( AFTER 15 DAYS )
this.dateRefund = new Date(((this.campaign?.endDate?.getTime() / 1000) + environment.dateRefund ) * 1000)

if((this.dateRefund.getTime() - Date.now()) > 0) {
this.dateRefund = new Date(
(this.campaign?.endDate?.getTime() / 1000 + environment.dateRefund) *
1000
);
let diffTime = this.dateRefund.getTime() - Date.now();

if (this.dateRefund.getTime() - Date.now() > 0) {
this.refundButtonDisable = true;
} else {
this.refundButtonDisable = false;
}
// CALCULATE THE DAYS :
this.dateRefundDays = Math.floor((this.dateRefund.getTime() - Date.now()) / (1000 * 60 * 60 * 24 ));

// CALCULATE THE DAYS :
this.dateRefundDays = Math.floor(diffTime / (1000 * 60 * 60 * 24));

// CALCULATE THE HOURS :
this.dateRefundHours = Math.floor(((this.dateRefund.getTime() - Date.now()) / (1000 * 60 * 60 * 24 ) - this.dateRefundDays ) * 24 )

this.dateRefundHours = Math.floor(
(diffTime / (1000 * 60 * 60 * 24) - this.dateRefundDays) * 24
);

// CALCULATE MINUTES :
this.dateRefundMinutes = Math.floor(((((this.dateRefund.getTime() - Date.now()) / (1000 * 60 * 60 * 24 ) - this.dateRefundDays ) * 24) - this.dateRefundHours) * 60)
// CALCULATE MINUTES :
this.dateRefundMinutes = Math.floor(
((diffTime / (1000 * 60 * 60 * 24) - this.dateRefundDays) * 24 -
this.dateRefundHours) *
60
);
this.loadingData = false;
}, 500)
}, 1500)


}
Expand Down
Loading