Skip to content
This repository was archived by the owner on Jul 21, 2019. It is now read-only.

Commit 76cf879

Browse files
committed
updates CFP OPEN footer to use time comparions
The existing footer takes the current time (build time), casts it to a string, and compares it with the CFP start/end times which are also being re-cast to strings here (twice!). In order to allow us to use timezones as part of our comparison and not have the formatting involved in comparisons, use the `time` template function and directly compare against `now` without typecasting. ref https://gohugo.io/functions/time/ ref https://gohugo.io/functions/now/
1 parent 01b2b5b commit 76cf879

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

exampleSite/data/events/2018-singapore.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ enddate: 2018-10-12 # The end date of your event. Leave blank if you don't have
1111

1212
# Leave CFP dates blank if you don't know yet, or set all three at once.
1313
cfp_date_start: 2018-07-05 # start accepting talk proposals.
14-
cfp_date_end: 2018-08-31 # close your call for proposals.
14+
cfp_date_end: 2018-08-31T00:00:00+08:00 # close your call for proposals.
1515
cfp_date_announce: 2018-09-11 # inform proposers of status
1616

1717
cfp_open: "false"
@@ -277,4 +277,3 @@ program:
277277
date: 2018-10-12
278278
start_time: "16:45"
279279
end_time: "17:00"
280-

layouts/partials/footer.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ <h2 class="footer-heading">{{ dateFormat "02 January, 2006" .Date }}</h2>
4747
<h3 class="footer-nav">CFP OPEN</h3>
4848
{{- range sort $.Site.Data.events "startdate" -}}
4949
{{- if .cfp_date_end -}}
50-
{{- if and (ge (dateFormat "2006-01-02" (dateFormat "2006-01-02" now)) (dateFormat "2006-01-02" .cfp_date_start)) (ge (dateFormat "2006-01-02" .cfp_date_end) (dateFormat "2006-01-02" (dateFormat "2006-01-02" now))) -}}
50+
{{- if and (ge now (time .cfp_date_start)) (ge (time .cfp_date_end) now) -}}
5151
<a href = "{{ (printf "events/%s" .name) | absURL }}" class = "footer-content">{{ .city }}</a><br />
5252
{{- end -}} {{/* end: date is now or afterwards */}}
5353
{{- end -}} {{/* end: if .cfp_date_end */}}

0 commit comments

Comments
 (0)