Skip to content

Commit 2fcb00c

Browse files
committed
Update California clock change to include text about if is currently daylight savings time or not
Prompt was: > Update California clock change to include text about if is currently daylight savings time or not --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/simonw/tools?shareId=XXXX-XXXX-XXXX-XXXX).
1 parent 87e2577 commit 2fcb00c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

california-clock-change.html

+10
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ <h1>California Clock Change</h1>
104104
<div id="past-change"></div>
105105
<div id="future-change"></div>
106106
<div id="body-clock"></div>
107+
<div id="current-dst"></div>
107108
</div>
108109

109110
<script>
@@ -241,6 +242,15 @@ <h1>California Clock Change</h1>
241242

242243
// Update body clock info based on past change
243244
updateBodyClockInfo(pastChange);
245+
246+
// Determine if it is currently daylight savings time or not
247+
const currentDstDiv = document.getElementById('current-dst');
248+
const isDst = pastChange.isSpringForward && futureChange.isSpringForward;
249+
currentDstDiv.className = 'info-box';
250+
currentDstDiv.innerHTML = `
251+
<div>Current status:</div>
252+
It is currently <span class="highlight">${isDst ? 'Daylight Saving Time (PDT)' : 'Standard Time (PST)'}</span>.
253+
`;
244254
}
245255

246256
updateInfo();

0 commit comments

Comments
 (0)