Skip to content

Commit 660b0ef

Browse files
authored
Merge pull request #125 from rubyuy/santib/fix-meetup-date-toggle
Fix automatic show/hide next meetup
2 parents c43659f + 0e56a3d commit 660b0ef

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

_includes/next_meetup.html

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
{% assign next_meetup = site.data.next_meetup %}
22
{% assign host = site.data.companies[next_meetup.host] %}
3-
{% assign today = "now" | date: "%Y-%m-%d" %}
43

5-
{% if next_meetup.show and next_meetup.date_iso >= today %}
6-
<section class="next-meetup">
4+
{% if next_meetup.show %}
5+
<section class="next-meetup" style="display:none" data-meetup-date="{{ next_meetup.date_iso }}">
76
<header>
87
<div class="next-meetup-callout" aria-hidden=true>
98
<h1 class="next-meetup-callout__title">Próxima meetup</h1>
@@ -57,4 +56,12 @@ <h1 aria-label="First Speaker Name">
5756
</ul>
5857
</article>
5958
</section>
59+
<script>
60+
(function() {
61+
var el = document.querySelector('[data-meetup-date]');
62+
if (!el) return;
63+
var meetupDate = new Date(el.dataset.meetupDate + 'T23:59:59');
64+
if (new Date() <= meetupDate) el.style.display = '';
65+
})();
66+
</script>
6067
{% endif %}

0 commit comments

Comments
 (0)