Skip to content

Commit

Permalink
Update time.js
Browse files Browse the repository at this point in the history
  • Loading branch information
biijuwa committed Jan 22, 2025
1 parent 1c64db2 commit 56af79a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions time.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@ function updateTime() {
timeZone: 'Asia/Kathmandu',
hour12: false,
hour: '2-digit',
minute: '2-digit',
month: 'short',
day: 'numeric',
};

const now = new Date().toLocaleString('en-US', options);
const currentHour = parseInt(now.substring(0, 2));

document.getElementById('time-display').innerText = now;

if (currentHour >= 18) {
document.body.style.backgroundColor = 'black';
} else {
document.body.style.backgroundColor = 'white'; // or your preferred default color
}
}

// Update time every second
Expand Down

0 comments on commit 56af79a

Please sign in to comment.