From: tangxiaofeng <tangxiaofeng@kylinos.cn>
Date: Tue, 16 Sep 2026 03:50:35 +0000
Subject: [PATCH] fix: use Date::to_string() instead of Rfc3339 for format: "date" query params

Description: The code generator treated format: "date" and format: "date-time"
 identically, formatting both with Rfc3339. RFC 3339 requires date + time +
 offset, but time::Date only supplies the date component. time crate v0.3.47
 added a compile-time const assertion enforcing this, turning a latent runtime
 bug into a compile error (error[E0080]: evaluation panicked: Rfc3339 requires
 date, time, and offset components). Format: "date" fields now use
 Date::to_string(), which produces ISO 8601 YYYY-MM-DD via time::Date's Display
 impl, matching the API parameter declared as format: "date".
 .
 Affects four activity feed query structs: OrgListActivityFeedsQuery,
 RepoListActivityFeedsQuery, OrgListTeamActivityFeedsQuery,
 UserListActivityFeedsQuery.
Author: tangxiaofeng <tangxiaofeng@kylinos.cn>
Origin: upstream, https://codeberg.org/Cyborus/forgejo-api/commit/82a5180b87
Bug: https://codeberg.org/Cyborus/forgejo-api/issues/136
Forwarded: not-needed
Last-Update: 2026-09-16
---
--- forgejo-api-0.9.0.orig/src/generated/structs.rs
+++ forgejo-api-0.9.0/src/generated/structs.rs
@@ -5002,11 +5002,7 @@ impl OrgListActivityFeedsQuery {
     pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
         let mut list = Vec::new();
         if let Some(date) = self.date {
-            list.push((
-                "date",
-                date.format(&time::format_description::well_known::Rfc3339)
-                    .unwrap(),
-            ));
+            list.push(("date", date.to_string()));
         }
 
         list
@@ -5617,11 +5613,7 @@ impl RepoListActivityFeedsQuery {
     pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
         let mut list = Vec::new();
         if let Some(date) = self.date {
-            list.push((
-                "date",
-                date.format(&time::format_description::well_known::Rfc3339)
-                    .unwrap(),
-            ));
+            list.push(("date", date.to_string()));
         }
 
         list
@@ -6837,11 +6829,7 @@ impl OrgListTeamActivityFeedsQuery {
     pub(crate) fn into_list(self) -> Vec<(&'static str, String)> {
         let mut list = Vec::new();
         if let Some(date) = self.date {
-            list.push((
-                "date",
-                date.format(&time::format_description::well_known::Rfc3339)
-                    .unwrap(),
-            ));
+            list.push(("date", date.to_string()));
         }
 
         list
@@ -7111,11 +7099,7 @@ impl UserListActivityFeedsQuery {
             list.push(("only-performed-by", only_performed_by.to_string()));
         }
         if let Some(date) = self.date {
-            list.push((
-                "date",
-                date.format(&time::format_description::well_known::Rfc3339)
-                    .unwrap(),
-            ));
+            list.push(("date", date.to_string()));
         }
 
         list
