corretto problema che si aggiornava a fatica... si bloccava... era una label che veniva continuamente azzerata e riscritta...

This commit is contained in:
Surya Paolo
2024-02-09 00:25:51 +01:00
parent 288318fdb6
commit aa108d9213
8 changed files with 141 additions and 29 deletions

View File

@@ -8354,6 +8354,31 @@ export const tools = {
// Calculate the difference in milliseconds
const countdown = targetTime - currentDate.getTime();
if (countdown > 0) {
// Convert milliseconds to seconds
const countdownInSeconds = Math.floor(countdown / 1000);
const days = Math.floor(countdownInSeconds / (60 * 60 * 24));
const hours = Math.floor((countdownInSeconds % (60 * 60 * 24)) / (60 * 60));
const minutes = Math.floor((countdownInSeconds % (60 * 60)) / 60);
const gg = days > 0 ? 'giorni' : ''
const strgg = gg ? `${days} giorni` : ''
return (`${strgg} ${this.pad(hours)}h ${this.pad(minutes)}m`);
} else {
return '';
}
},
getCountDownWithSeconds(mydate: Date) {
const currentDate = new Date();
const targetTime = new Date(mydate).getTime();
// Calculate the difference in milliseconds
const countdown = targetTime - currentDate.getTime();
if (countdown > 0) {
// Convert milliseconds to seconds
const countdownInSeconds = Math.floor(countdown / 1000);