Skip to content

Commit a4abee9

Browse files
authored
Update index.html
1 parent 5d20315 commit a4abee9

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

index.html

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
align-items: center;
2424
justify-content: flex-start;
2525
padding-top: 50px;
26+
user-select: none; /* Disable text selection */
2627
}
2728

2829
.center-section {
@@ -157,7 +158,7 @@
157158

158159
<div class="middle-wrapper">
159160
<div class="middle-section">
160-
<div class="time" id="time">00:04</div>
161+
<div class="time" id="time">12:04 AM</div>
161162
<div class="greeting" id="greeting">Good night, Zor</div>
162163
<div class="button-grid">
163164
<a href="https://www.reddit.com" class="button">
@@ -189,9 +190,12 @@
189190
<script>
190191
function updateTime() {
191192
const now = new Date();
192-
const hours = String(now.getHours()).padStart(2, '0');
193-
const minutes = String(now.getMinutes()).padStart(2, '0');
194-
document.getElementById('time').textContent = `${hours}:${minutes}`;
193+
let hours = now.getHours();
194+
let minutes = String(now.getMinutes()).padStart(2, '0');
195+
let ampm = hours >= 12 ? 'PM' : 'AM';
196+
hours = hours % 12;
197+
hours = hours ? hours : 12; // the hour '0' should be '12'
198+
document.getElementById('time').textContent = `${hours}:${minutes} ${ampm}`;
195199

196200
const days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
197201
const months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];

0 commit comments

Comments
 (0)