JSFiddle - React, Tailwind, and code Playground

HTML

<!DOCTYPE html>
<html>

<style>
table, th, td {
    border: 1px solid black;
    border-collapse: collapse;
}
th,td {
	text-align: center;
}
</style>


<body>

<h1>Kalkulator Posisi Matahari & Bulan</h1>

<br>
Koordinat Pengamat:<br>
Lintang: <input id="lat" type="text" name="lat" value="-6.1754">  Bujur: <input id="lon" type="text" name="lon" value="106.8272"><br><br>
Waktu:<br>
Tanggal: <input id="date" type="text" name="date" value="20"> Bulan: <input id="month" type="text" name="month" value="3"> Tahun: <input id="year" type="text" name="year" value="2017"><br>
Jam: <input id="hour" type="text" name="hour" value="7"> Menit: <input id="minute" type="text" name="minute" value="0"> Detik: <input id="second" type="text" name="second" value="0"> UTC (+/-): <input id="gap" type="text" name="gap" value="7"><br>
<br>
Interval (menit): <input id="interval" type="text" name="interval" value="10"><br>
Loop : <input id="loop" type="text" name="loop" value="1">


<br>
<br>


<button type="button"
onclick='document.getElementById("demo").innerHTML = calculate()'>
Hitung!</button>

<p id="demo"></p>

</body>
<script>
////math.js
// JavaScript by Peter Hayes http://www.peter-hayes.freeserve.co.uk/
// Copyright 2001-2003
// This code is made freely available but please keep this notice.
// I accept no liability for any errors in my coding but please
// let me know of any errors you find. My address is on my home page.

// Extensions to the Math routines - Trig routines in degrees

function rev(angle){return angle-Math.floor(angle/360.0)*360.0;}
function sind(angle){return Math.sin((angle*Math.PI)/180.0);}
function cosd(angle){return Math.cos((angle*Math.PI)/180.0);}
function tand(angle){return Math.tan((angle*Math.PI)/180.0);}
function asind(c){return (180.0/Math.PI)*Math.asin(c);}
function acosd(c){return (180.0/Math.PI)*Math.acos(c);}
function atan2d(y,x){return (180.0/Math.PI)*Math.atan(y/x)-180.0*(x<0);}
function abs(x){return Math.abs(x)}
function sqrt(x) {return...