Skip to content

Commit

Permalink
set start time on time stamper component
Browse files Browse the repository at this point in the history
  • Loading branch information
Dedekind561 committed Nov 19, 2024
1 parent aebaf70 commit f9f0d29
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion common-theme/assets/scripts/time-stamper.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ class TimeStamper extends HTMLElement {
`;

this.timelineEntries = this.querySelectorAll(".c-block");
this.startTime = this.getAttribute('start-time');
}

connectedCallback() {
this.stampTime();
}

stampTime() {
let currentTime = new Date("1970-01-01T10:00:00"); // Set initial time to 10:00 AM
let currentTime = new Date(`1970-01-01T${this.startTime}`); // Set initial time to 10:00 AM

this.timelineEntries.forEach((entry) => {
const timeElement = entry.querySelector(".c-block__time");
Expand Down
1 change: 1 addition & 0 deletions common-theme/hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ defaultContentLanguageInSubdir = false
[params]
googleFonts="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;500;700&family=Inter:wght@400;600&display=swap"
description = "A free and open source software development programme."
startTime="10:00"
# main_website = ""
# main_org_name = "eg Code Your Future"
# our_name = "alias for in text replacement"
Expand Down
3 changes: 1 addition & 2 deletions common-theme/layouts/_default/day-plan.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
{{ errorf "There are no blocks on the %s page. Make sure this day plan has blocks." $.Page.RelPermalink }}
{{ end }}


<time-stamper>
<time-stamper start-time="{{ .Params.startTime | '10:00' }}">
<div class="c-block__series c-block__series--timeline">
{{ if ne .Params.noRegister true }}
{{ partial "register-attendance.html" (dict "course" site.Title "module" $.Page.CurrentSection.Parent.Title "day" $.Page.CurrentSection.Title) }}
Expand Down

0 comments on commit f9f0d29

Please sign in to comment.