Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tor s - digital-clock - octos #37

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
33 changes: 25 additions & 8 deletions index.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,32 @@ body {
background-color: #80d4ea;
}

#clock {
height: 100px;
width: 800px;
margin: auto;
position: absolute;
top: 0; left: 0; bottom: 0; right: 0;
padding-top: 70px;
#city-selector {
display: grid;
grid-template-columns: 50% 1fr;
grid-template-rows: 50% 1fr;
}

#city-selector > div {
min-width: 50vw;
max-width: 50vw;
min-height: 50vh;
max-height: 50vh;
}

#seattle-clock, #guam-clock, #hawaii-clock, #london-clock {
/*height: 100px;*/
max-width: 30vw;
margin: 5vh 5vw;
/*position: absolute;*/
/*top: 0; left: 0; bottom: 0; right: 0;*/
padding-top: 5vh;
font-family: courier, monospace;
text-align: center;
color: white;
font-size: 100px;
font-size: 4rem;
}

.city-clock {
font-size: 2.5rem;
}
34 changes: 33 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,39 @@
</head>

<body>
<div id='clock'></div>
<section id='city-selector'>

<div id='seattle-clock'>
Seattle, USA
<div class='city-clock'>
</div>
</div>

<div id='guam-clock'>
Guam, USA
<div class='city-clock'>
</div>
</div>

<div id='hawaii-clock'>
Hawaii, USA
<div class='city-clock'>
</div>
</div>

<div id="london-clock">
London, UK
<div class='city-clock'>
</div>
</div>

</section>


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

Expand Down
42 changes: 41 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1 +1,41 @@
// Your code here
const getTime = () => {
let newTime = new Date();
$('#seattle-clock > .city-clock').html(newTime);
};

const timeBuilder = () => {
let newTime = new Date();
let utc = newTime.getTime()// + (newTime.getTimezoneOffset() * 60000);
return utc
}

const guamTime = () => {
let utc = timeBuilder()
let calculatedTime = new Date(utc + (3600000 * 17))

$('#guam-clock > .city-clock').html(calculatedTime);
};

const hawaiiTime = () => {
let utc = timeBuilder()
let calculatedTime = new Date(utc + (3600000 * -3))

$('#hawaii-clock > .city-clock').html(calculatedTime);
};

const londonTime = () => {
let utc = timeBuilder()
let calculatedTime = new Date(utc + (3600000 * 8))

$('#london-clock > .city-clock').html(calculatedTime);
};




$(document).ready(() => {
setInterval(getTime, 1000);
setInterval(guamTime, 1000);
setInterval(hawaiiTime, 1000);
setInterval(londonTime, 1000);
});