- filtro se GAS o Prodotti

This commit is contained in:
Surya Paolo
2023-12-28 21:00:10 +01:00
parent 196b19ac66
commit ed76b9c1dd
12 changed files with 207 additions and 36 deletions

View File

@@ -8281,6 +8281,33 @@ export const tools = {
strToVal(mystr: string) {
return parseInt(mystr)
},
pad(value: any) {
// Helper function to pad single-digit values with leading zeros
return value < 10 ? `0${value}` : value;
},
getCountDown(mydate: Date) {
const currentDate = new Date();
const targetTime = new Date(mydate).getTime();
// Calculate the difference in milliseconds
const countdown = targetTime - currentDate.getTime();
// 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 seconds = countdownInSeconds % 60;
const gg = days > 0 ? 'giorni' : ''
const strgg = gg ? `${days} giorni` : ''
return (`${strgg} ${this.pad(hours)}:${this.pad(minutes)}:${this.pad(seconds)}`);
}
// FINE !