www-community icon indicating copy to clipboard operation
www-community copied to clipboard

Community Events page has a difficult to understand format

Open vanderaj opened this issue 2 years ago • 9 comments

The code that generates a list of community events from Meetup:

pages/social/community_events.md

generates output like:

image

This is confusing, as the end time is not 4 pm, but another time entirely. This is actually saying the time zone in the image.

Could the time zone be separated out and made more obvious?

Time: 10:30 (-4 America/Toronto)

or just

Time: 10:30 am (America/Toronto)

vanderaj avatar Mar 13 '24 11:03 vanderaj

Go for it!

kingthorin avatar Oct 15 '24 06:10 kingthorin

Thank you for pointing this out, I can see this issue is still unresolved. I understand the issue and agree that separating the time zone and making it more explicit would improve clarity for users. I’ll start working on updating the time formatting to include the time zone in a more user-friendly format, such as:

Time: 10:30 am (America/Toronto)

or

Time: 10:30 (-4 America/Toronto)

I’ll make the necessary adjustments and test the output to ensure accuracy. Please let me know if you have a preference for the exact format! Also, Can you please assign me this issue it would be great @vanderaj @kingthorin

justtcallmejayy avatar Jan 17 '25 20:01 justtcallmejayy

I'd suggest Time: 10:30 am (America/Toronto) then you don't have to worry about, ex: EST vs EDT.

kingthorin avatar Jan 17 '25 20:01 kingthorin

I attempted to resolve the issue using the code:

Time: {{ event.date | append: "T" | append: event.time | date: "%I:%M %p" }} ({{ event.timezone }})

However, the output remains in the format Time: 19:00+01:00 (Europe/Berlin). Despite testing multiple variations, the desired format (e.g., Time: 7:00 pm (Europe/Berlin)) is not displaying correctly. Could someone confirm if there’s an issue with the liquid templating or point out where adjustments may be needed?

Thank you!

justtcallmejayy avatar Jan 20 '25 03:01 justtcallmejayy

It seems that's literally the data in the file.

If someone knew what the solution was they already would have opened a PR.

kingthorin avatar Jan 20 '25 12:01 kingthorin

It's not exactly pretty (code wise) but this is workable: (Ignore the misplaced pink highlight on the first one.) Image

Image

iff --git a/pages/social/community_events.md b/pages/social/community_events.md
index 36352cd..b2600cc 100644
--- a/pages/social/community_events.md
+++ b/pages/social/community_events.md
@@ -41,7 +41,20 @@ permalink: meetings/
 {% endif %}
 ### Event: <a name="{{ i }}_item">{{ event.name }} </a>
 #### Group: [{{ event.group }}](/{{ event.repo }}/)
-#### Time: {{ event.time }} ({{ event.timezone }})
+{% if event.time contains '-' %}
+  {% assign timeparts = event.time | split: '-' %}
+  {% if timeparts.size > 0 %}
+    {% assign displaytime = timeparts[0] | append: " (-" | append: timeparts[1] | append: ' ' | append: event.timezone | append: ')' %}
+  {% endif %}
+{% endif %}
+
+{% if event.time contains '+' %}
+  {% assign timeparts = event.time | split: '+' %}
+  {% if timeparts.size > 0 %}
+    {% assign displaytime = timeparts[0] | append: " (+" | append: timeparts[1] | append: ' ' | append: event.timezone | append: ')' %}
+  {% endif %}
+{% endif %}
+#### Time: {{ displaytime }}
 #### Link: [{{ event.link }}]({{ event.link }})
 <div>
 <strong>Description</strong>: {{ event.description }}

kingthorin avatar Jan 20 '25 16:01 kingthorin

I’ve implemented the following logic for handling the time formatting:

{% if event.time contains '-' %}
  {% assign timeparts = event.time | split: '-' %}
  {% assign displaytime = timeparts[0] | append: " (-" | append: timeparts[1] | append: " " | append: event.timezone | append: ")" %}
{% elsif event.time contains '+' %}
  {% assign timeparts = event.time | split: '+' %}
  {% assign displaytime = timeparts[0] | append: " (+" | append: timeparts[1] | append: " " | append: event.timezone | append: ")" %}
{% else %}
  {% assign displaytime = event.time %}
{% endif %}
#### Time: {{ displaytime }}

However, the output remains unchanged and still displays the original format like Time: 19:00+01:00 (Europe/Berlin). Despite testing different approaches, the expected format, such as Time: 7:00 pm (Europe/Berlin), does not render correctly. i also tried on multiple devices such as on mac OS, later on the GITHUB CODESPACE, that took my 5-6 days on this issue and yet it is still unsolved. Please direct me if I am in wrong direction.

Could someone confirm if there’s any additional processing step or data issue that could be affecting this? Any guidance would be greatly appreciated!

Thank you!

justtcallmejayy avatar Jan 27 '25 20:01 justtcallmejayy

I'm not sure how you tested it. The example I provided was checked in a local testing server. https://OWASP.org/migration has details

kingthorin avatar Jan 27 '25 20:01 kingthorin