corretto problema che si aggiornava a fatica... si bloccava... era una label che veniva continuamente azzerata e riscritta...
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user