Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions index.css
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
@import url('https://fonts.googleapis.com/css?family=Orbitron');




body {
background-color: #80d4ea;
font-family: 'Orbitron', sans-serif;
}

#clock {
.clock {
height: 100px;
width: 800px;
margin: auto;
position: absolute;
top: 0; left: 0; bottom: 0; right: 0;
padding-top: 70px;
font-family: courier, monospace;
text-align: center;
color: white;
font-size: 100px;
font-size: 60px;
}
14 changes: 11 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@
</head>

<body>
<div id='clock'></div>
<div class="clock">

</div>

<script
src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
<script src="moment.js"></script>
<script src="moment-timezone-with-data.js"></script>
<script src="index.js"></script>
</body>
</html>

<script src="index.js"></script>
27 changes: 26 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1 +1,26 @@
// Your code here
$(document).ready(function() {

var timezones = [
{class: "pacific", name: "Seattle", offset: 0},
{class: "eastern", name: "Boston", offset: 3}
];

timezones.forEach(function(zone) {
$('.clock').append("<div class='" + zone.class + "'></div>");
});

var getTimes = function() {timezones.forEach(function(zone) {
var time = new Date();
var utcTime = time.getTime();
var localTime = new Date(utcTime + (Number(zone.offset)*60*60*1000));
localTime = localTime.toString().substring(16, 24);
$("." + zone.class).empty().append(zone.name + ": " + localTime );
console.log("." + zone.class);
console.log(zone);
});
};

setInterval(getTimes, 500);


});