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
6 changes: 6 additions & 0 deletions clock_app/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions clock_app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<title>Clock App</title>
<link rel="stylesheet" href="style.css">
<link rel="apple-touch-icon" href="icon.svg">
</head>
<body>
<div id="clock-container">
<div id="time">00:00:00</div>
<div id="date">YYYY/MM/DD (Day)</div>
</div>
<script src="script.js"></script>
</body>
</html>
27 changes: 27 additions & 0 deletions clock_app/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
function updateClock() {
const now = new Date();

// Time
const hours = String(now.getHours()).padStart(2, '0');
const minutes = String(now.getMinutes()).padStart(2, '0');
const seconds = String(now.getSeconds()).padStart(2, '0');
const timeString = `${hours}:${minutes}:${seconds}`;

document.getElementById('time').textContent = timeString;

// Date
const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, '0');
const day = String(now.getDate()).padStart(2, '0');
const days = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
const dayName = days[now.getDay()];
const dateString = `${year}/${month}/${day} (${dayName})`;

document.getElementById('date').textContent = dateString;
}

// Initial call
updateClock();

// Update every second
setInterval(updateClock, 1000);
46 changes: 46 additions & 0 deletions clock_app/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
body {
margin: 0;
padding: 0;
background-color: #000;
color: #fff;
font-family: "SF Mono", "Monaco", "Inconsolata", "Fira Mono", "Droid Sans Mono", "Source Code Pro", monospace;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
user-select: none;
-webkit-user-select: none;
-webkit-touch-callout: none;
}

#clock-container {
text-align: center;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
}

#time {
font-size: 18vw;
font-weight: bold;
line-height: 1;
letter-spacing: -0.05em;
}

#date {
font-size: 5vw;
margin-top: 2vh;
color: #888;
}

@media (orientation: landscape) {
#time {
font-size: 25vh;
}
#date {
font-size: 6vh;
}
}