JavaScript'te Gün Sonu

Mevcut günün sonunu içeren bir tarih nesnesi alalım:

javascriptlet now  = new Date();
let date = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59);

Mevcut günün sonu, bir sonraki günün gece yarısı olarak da hesaplanabilir (1 saniye fark):

javascriptlet now  = new Date();
let date = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1, 0, 0, 0);

Bildiğiniz gibi, bu durumda sıfırları atlayabilirsiniz:

javascriptlet now  = new Date();
let date = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1);

Bu arada, gece yarısı aynı zamanda mevcut günün 24:00:00 saatine de denk gelir:

javascriptlet now  = new Date();
let date = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 24, 0, 0);

Sıfırları atlayalım:

javascriptlet now  = new Date();
let date = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 24);
Задание 1

Gün sonuna kaç saat kaldığını belirleyin.