This is an automated email from the ASF dual-hosted git repository.

gstein pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/steve.git

commit a1efb6844a31fb5f95448ad70fbe7fceb2756602
Author: Greg Stein <[email protected]>
AuthorDate: Thu Oct 2 04:07:34 2025 -0500

    Iterate the date format/presentation a bit.
---
 v3/server/pages.py            |  8 ++++----
 v3/server/templates/voter.ezt | 32 ++++++++++++++++++++------------
 2 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/v3/server/pages.py b/v3/server/pages.py
index 4938350..d5555e7 100644
--- a/v3/server/pages.py
+++ b/v3/server/pages.py
@@ -86,7 +86,7 @@ async def voter_page():
             return None
         # 66% days, then: 50% hours or minutes each
         if random.randrange(3):
-            delta = random.randint(10, 50) * 24 * 60 * 60  # days
+            delta = random.randint(5, 20) * 24 * 60 * 60  # days
         elif random.randrange(2):
             delta = random.randint(5, 40) * 60 * 60  # hours
         else:
@@ -185,10 +185,10 @@ def format_datetime(dt):
     delta = dt.timestamp() - datetime.datetime.now().timestamp()
     if 0 < delta < SOON_CUTOFF:
         if delta < SOON_1HOUR:
-            return f'about {int(delta / 60)} minutes'
-        return f'about {int(delta / 60 / 60)} hours'
+            return f'in about {int(delta / 60)} minutes'
+        return f'in about {int(delta / 60 / 60)} hours'
 
-    return dt.strftime(FMT_DATE)  # short format
+    return f'on {dt.strftime(FMT_DATE)}'  # short format
 
 
 def postprocess_election(e):
diff --git a/v3/server/templates/voter.ezt b/v3/server/templates/voter.ezt
index 24a4b1e..1699a71 100644
--- a/v3/server/templates/voter.ezt
+++ b/v3/server/templates/voter.ezt
@@ -21,18 +21,26 @@
                             </p>
                         </div>
                         <div class="card-footer text-muted">
-                            <div>
-                            OPEN:
-                                [election.open_at]
-                                [election.fmt_open_at]
-                                [election.fmt_open_at_full]
-                            </div>
-                            <div>
-                            CLOSE:
-                                [election.close_at]
-                                [election.fmt_close_at]
-                                [election.fmt_close_at_full]
-                            </div>
+                            [if-any election.closed]
+                                Closed on
+                                <span 
title="[election.fmt_close_at_full]">[election.fmt_close_at]</span>
+                            [else]
+                                already open?
+                                [if-any election.open_at]
+                                    <br/>
+                                    Opening
+                                    <span title="[election.fmt_open_at_full]"
+                                        style="border-bottom: 1px dotted 
#007bff;"
+                                        >[election.fmt_open_at]</span>
+                                [end]
+                                [if-any election.close_at]
+                                    <br/>
+                                    Closing
+                                    <span title="[election.fmt_close_at_full]"
+                                        style="border-bottom: 1px dotted 
#007bff;"
+                                        >[election.fmt_close_at]</span>
+                                [end]
+                            [end]
                         </div>
                     </div>
                 </a>

Reply via email to