Countdown until date with jpeg/svgs

I would love to make/use a javascript which counts down until a certain date.

(example: the 1th of sept)

What should it do?

This script should delete an image jpeg or svg (10px x 10px) daily. So the script should have the amount of days in pictures left.

(example: 29 days left so 29 pictures on the website, tomorrow 28 pictures, day after 27 pictures)

Does anyone know a code that would allow this kind of a “daily update” to happen automatically?
Any help would be very much appreciated!

Source: stackoverflow-javascript