v2.5.2
Giriş yap

JS Geri Sayım Hakkında

siyahkalem
284 defa görüntülendi

Geri sayım saycınında tek veri olmasına rağmen farklı farklı tarihleri seçtiğimde aşağıdaki resimlerdeki gibi olmaktadır.
Bu durumu nasıl çözebilirim. Sayım çalışıyor herhangi bir sorun yok ama başka verinin tarini seçtiğimde önceki tarihte asılı kalıyor.

Destekleriniz için şimdiden teşekkürler.

    // kodlarınız buraya eklenecek
    
    selectItem(item){
    if (item.periodValidityTime > 0) {

  
                const launchDate = new Date(item.tiktak);


                var x = setInterval(() => {

                  
                    const currentDate = new Date();
                    const launchTime = launchDate - currentDate;

                    const days = Math.floor(launchTime / (1000 * 60 * 60 * 24));
                    const hours = Math.floor((launchTime % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
                    const minutes = Math.floor((launchTime % (1000 * 60 * 60)) / (1000 * 60));
                    const seconds = Math.floor((launchTime % (1000 * 60)) / 1000);

                    this.seconds = seconds;
                    this.minutes = minutes;
                    this.hours = hours;
                    this.days = days;

                    if (minutes < 0) {

                        this.seconds = 0;
                        this.minutes = 0;
                        this.hours = 0;
                        this.days = 0;

                    }


                }, 1000)



            }
            
             }
Cevap yaz
Cevaplar (0)
Henüz kimse cevap yazmadı. İlk cevap yazan sen ol!