Skip to content

Commit

Permalink
Merge pull request #191 from devopsdays/mattstratton/fix-null-dates
Browse files Browse the repository at this point in the history
Fix to allow for empty start, end, and cfp dates
  • Loading branch information
mattstratton committed May 3, 2016
2 parents 06bd0fd + 886ce84 commit 2b40d39
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
8 changes: 5 additions & 3 deletions layouts/shortcodes/cfp_dates.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@
{{ $event_slug := index $path 1 }}
{{ $e := (index .Page.Site.Data.events $event_slug) }}

{{ if isset $e "cfp_date_start" }}
{{ if and ($e.cfp_date_start) ($e.cfp_date_end) ($e.cfp_date_announce)}}

{{ $cfp_date_start := $e.cfp_date_start }}
{{ $cfp_date_end := $e.cfp_date_end }}
{{ $cfp_date_announce := $e.cfp_date_announce }}



<center>
<b>Call for proposals opens {{ dateFormat "Monday, Jan 2, 2006" $cfp_date_start }}.</b><br>
<b>Call for proposals closes {{ dateFormat "Monday, Jan 2, 2006" $cfp_date_end }}.</b><br>
Selected proposals will be announced on {{ dateFormat "Monday, Jan 2, 2006" $cfp_date_announce }}.
</center>
{{ else }}
<center>
<b>Call for proposals is TBD</b>
</center>
{{ end }}
3 changes: 2 additions & 1 deletion layouts/shortcodes/event_end.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
{{ $e := (index .Page.Site.Data.events $event_slug) }}
{{ $enddate := $e.enddate}}

{{ if isset $e "enddate" }}
{{ if $e.enddate }}
{{ $enddate := $e.enddate}}
{{ dateFormat "Monday, Jan 2, 2006" $enddate }}
{{ else }}
TBD
Expand Down
5 changes: 2 additions & 3 deletions layouts/shortcodes/event_start.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
{{ $event_slug := index $path 1 }}
{{ $e := (index .Page.Site.Data.events $event_slug) }}

{{ $startdate := $e.startdate}}

{{ if isset $e "startdate" }}
{{ if $e.startdate }}
{{ $startdate := $e.startdate}}
{{ dateFormat "Monday, Jan 2, 2006" $startdate }}
{{ else }}
TBD
Expand Down

0 comments on commit 2b40d39

Please sign in to comment.