JSFiddle - React, Tailwind, and code Playground
HTML
<html>
<head>
<script src="https://momentjs.com/downloads/moment.min.js"></script>
<script src="https://momentjs.com/downloads/moment-timezone-with-data-2012-2022.min.js"></script>
</head>
<body>
<div id="UTC0"></div>
<div id="Local"></div>
<div id="Converted">Select a timezone to convert to</div>
<select id="Timezones"></select>
</body>
</html>
JavaScript
var date;
var dtFormat = "YYYY-MM-DD HH:mm (UTC Z)"
var $t = $("#Timezones");
$.each(moment.tz.names(), function (index, value) {
$t.append("<option value='" + value + "'>" + value + "</option>");
});
$.get("https://api.tvmaze.com/shows/4/episodebynumber?season=1&number=1", function(data) {
date = moment(data.airstamp);
$("#UTC0").text("UTC 0 Time: " + date.utc().format(dtFormat));
$("#Local").text("Local Time: " + date.local().format(dtFormat));
});
$("#Timezones").change(function() {
if (date != undefined) {
$("#Converted").text("Converted Time: " + date.tz($(this).val()).format(dtFormat));
}
else {
alert("Did not retrieve date, unable to convert");
}
});