JSFiddle - React, Tailwind, and code Playground
HTML
<section id="s01">
<h1>if 3.16 puppies are born every second</h1>
<b id="badge01" class="now">0</b> puppies have been born so far.<br>
<b class="morning">?</b> puppies have been born today<br>
<b class="month">?</b> puppies have been born since the first of this month.
</section>
<hr>
<section id="s02">
<h1>if 5 kittens are born every second</h1>
<b id="badge02" class="now">0</b> kittens have been born so far.<br>
<b class="morning">?</b> kittens have been born today<br>
<b class="month">?</b> kittens have been born since the first of this month.
</section>
<hr>
<section id="s03">
<h1>if 7 rats are born every second</h1>
<b id="badge03" class="now">0</b> rats have been born so far.<br>
<b class="morning">?</b> rats have been born today<br>
<b class="month">?</b> rats have been born since the first of this month.
</section>
JavaScript
var start = new Date(),
midnight = new Date(start.getFullYear(), start.getMonth(), start.getDate(), 0),
first = new Date(start.getFullYear(), start.getMonth(), 1);
setInterval(function () {
var now = new Date(),
secondsFromStart = Math.floor((now - start)/1000),
secondsFromMidnight = Math.floor((now - midnight)/1000),
secondsFromFirst = Math.floor((now - first)/1000),
puppiesBornPerSec = 3.16,
puppiesStart = Math.round(secondsFromStart*puppiesBornPerSec*100) / 100,
puppiesMidnight = Math.round(secondsFromMidnight*puppiesBornPerSec*100) / 100,
puppiesFirst = Math.round(secondsFromFirst*puppiesBornPerSec*100) / 100;
// 3 puppies born every second
$('#badge01').text(puppiesStart.toFixed(2));
$('#s01 .morning').text(puppiesMidnight.toFixed(2));
$('#s01 .month').text(puppiesFirst.toFixed(2));
// 5 kittens born every second
$('#badge02').text(Math.floor(secondsFromStart*5));
$('#s02 .morning').text(Math.floor(secondsFromMidnight*5));
$('#s02 .month').text(Math.floor(secondsFromFirst*5));
// 7 rats born every second
$('#badge03').text(Math.floor(secondsFromStart*7));
$('#s03 .morning').text(Math.floor(secondsFromMidnight*7));
$('#s03 .month').text(Math.floor(secondsFromFirst*7));
}, 1000);