Skip to content

Commit

Permalink
Adding timezone to my home page.
Browse files Browse the repository at this point in the history
  • Loading branch information
tay committed Sep 20, 2024
1 parent 475f6ce commit 163f1a3
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 13 deletions.
1 change: 1 addition & 0 deletions content/pages/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<li><a href="/projects">Projects</a> - Takes you to my Projects page.</li>
<li><a href="/discord">Discord</a> - Redirects you to my Discord.</li>
<li><a href="/pages">Pages</a> - Takes you to this page.</li>
<li><a href="/readme">README</a> - Takes you to my README page.</li>
<li><a href="https://tayrp.substack.com/">Blog</a> - Takes you to my Substack.</li>
</div>
</div>
Expand Down
10 changes: 7 additions & 3 deletions layouts/_default/home.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
{{ define "main" }}
<main>
<div class="about">
<div>
<p>Hello and Welcome, My name is Tee.</p>
<div>
<h3 id="date-time">time</h3>
<script src="/assets/js/timezone.js"></script>
<p>Hello and Welcome, My name is Tee.</p>
<p>I like to go by Tee, Rhea, or Kara.</p>
<p>I like to go by Tee, Rhea, or Kara.</p>
</div>
</div>
</div>
</main>
{{ end }}
13 changes: 13 additions & 0 deletions public/assets/js/timezone.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
function displayDateTime() {
const timeZone = 'America/New_York';
const options = {
hour: 'numeric', minute: 'numeric', second: 'numeric', timeZone: timeZone,
timeZoneName: 'short'
};

const currentTime = new Date().toLocaleString('en-US', options);
document.getElementById('date-time').innerHTML = `It is ${currentTime} for Tee`;
}

setInterval(displayDateTime, 1000);
window.onload = displayDateTime;
10 changes: 7 additions & 3 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,14 @@

<main>
<div class="about">
<div>
<p>Hello and Welcome, My name is Tee.</p>
<div>
<h3 id="date-time">time</h3>
<script src="/assets/js/timezone.js"></script>
<p>Hello and Welcome, My name is Tee.</p>
<p>I like to go by Tee, Rhea, or Kara.</p>
<p>I like to go by Tee, Rhea, or Kara.</p>
</div>
</div>
</div>
</main>

<footer>
Expand Down
2 changes: 1 addition & 1 deletion public/index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<link>http://localhost:1313/pages/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>http://localhost:1313/pages/</guid>
<description>&lt;div&gt;&#xD;&#xA; &lt;div class=&#34;about&#34;&gt;&#xD;&#xA; &lt;div&gt;&#xD;&#xA; &lt;p&gt;A list of all pages on my website.&lt;/p&gt;&#xD;&#xA; &lt;p&gt;Some are hidden, Like eastereggs.&lt;/p&gt;&#xD;&#xA; &lt;li&gt;&lt;a href=&#34;http://localhost:1313/&#34;&gt;Home&lt;/a&gt; - Literally the home page.&lt;/li&gt;&#xD;&#xA; &lt;li&gt;&lt;a href=&#34;http://localhost:1313/about&#34;&gt;About&lt;/a&gt; - Literally the about page.&lt;/li&gt;&#xD;&#xA; &lt;li&gt;&lt;a href=&#34;http://localhost:1313/projects&#34;&gt;Projects&lt;/a&gt; - Literally the projects page.&lt;/li&gt;&#xD;&#xA; &lt;li&gt;&lt;a href=&#34;http://localhost:1313/discord&#34;&gt;Discord&lt;/a&gt; - Literally the discord page.&lt;/li&gt;&#xD;&#xA; &lt;li&gt;&lt;a href=&#34;http://localhost:1313/pages&#34;&gt;Pages&lt;/a&gt; - Literally this page.&lt;/li&gt;&#xD;&#xA; &lt;li&gt;&lt;a href=&#34;https://tayrp.substack.com/&#34;&gt;Blog&lt;/a&gt; - Literally the blog button.&lt;/li&gt;&#xD;&#xA; &lt;/div&gt;&#xD;&#xA;&lt;/div&gt;&#xD;&#xA;&lt;/div&gt;</description>
<description>&lt;div&gt;&#xD;&#xA; &lt;div class=&#34;about&#34;&gt;&#xD;&#xA; &lt;div&gt;&#xD;&#xA; &lt;p&gt;A list of all pages on my website.&lt;/p&gt;&#xD;&#xA; &lt;p&gt;Some are hidden, Like eastereggs.&lt;/p&gt;&#xD;&#xA; &lt;li&gt;&lt;a href=&#34;http://localhost:1313/&#34;&gt;Home&lt;/a&gt; - Takes you to my home page.&lt;/li&gt;&#xD;&#xA; &lt;li&gt;&lt;a href=&#34;http://localhost:1313/about&#34;&gt;About&lt;/a&gt; - Takes you to my About/Bio page.&lt;/li&gt;&#xD;&#xA; &lt;li&gt;&lt;a href=&#34;http://localhost:1313/projects&#34;&gt;Projects&lt;/a&gt; - Takes you to my Projects page.&lt;/li&gt;&#xD;&#xA; &lt;li&gt;&lt;a href=&#34;http://localhost:1313/discord&#34;&gt;Discord&lt;/a&gt; - Redirects you to my Discord.&lt;/li&gt;&#xD;&#xA; &lt;li&gt;&lt;a href=&#34;http://localhost:1313/pages&#34;&gt;Pages&lt;/a&gt; - Takes you to this page.&lt;/li&gt;&#xD;&#xA; &lt;li&gt;&lt;a href=&#34;http://localhost:1313/readme&#34;&gt;README&lt;/a&gt; - Takes you to my README page.&lt;/li&gt;&#xD;&#xA; &lt;li&gt;&lt;a href=&#34;https://tayrp.substack.com/&#34;&gt;Blog&lt;/a&gt; - Takes you to my Substack.&lt;/li&gt;&#xD;&#xA; &lt;/div&gt;&#xD;&#xA;&lt;/div&gt;&#xD;&#xA;&lt;/div&gt;</description>
</item>
<item>
<title></title>
Expand Down
13 changes: 7 additions & 6 deletions public/pages/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,13 @@
<div>
<p>A list of all pages on my website.</p>
<p>Some are hidden, Like eastereggs.</p>
<li><a href="/">Home</a> - Literally the home page.</li>
<li><a href="/about">About</a> - Literally the about page.</li>
<li><a href="/projects">Projects</a> - Literally the projects page.</li>
<li><a href="/discord">Discord</a> - Literally the discord page.</li>
<li><a href="/pages">Pages</a> - Literally this page.</li>
<li><a href="https://tayrp.substack.com/">Blog</a> - Literally the blog button.</li>
<li><a href="/">Home</a> - Takes you to my home page.</li>
<li><a href="/about">About</a> - Takes you to my About/Bio page.</li>
<li><a href="/projects">Projects</a> - Takes you to my Projects page.</li>
<li><a href="/discord">Discord</a> - Redirects you to my Discord.</li>
<li><a href="/pages">Pages</a> - Takes you to this page.</li>
<li><a href="/readme">README</a> - Takes you to my README page.</li>
<li><a href="https://tayrp.substack.com/">Blog</a> - Takes you to my Substack.</li>
</div>
</div>
</div>
Expand Down
13 changes: 13 additions & 0 deletions static/assets/js/timezone.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
function displayDateTime() {
const timeZone = 'America/New_York';
const options = {
hour: 'numeric', minute: 'numeric', second: 'numeric', timeZone: timeZone,
timeZoneName: 'short'
};

const currentTime = new Date().toLocaleString('en-US', options);
document.getElementById('date-time').innerHTML = `It is ${currentTime} for Tee`;
}

setInterval(displayDateTime, 1000);
window.onload = displayDateTime;

0 comments on commit 163f1a3

Please sign in to comment.