Dates: serve the display wall clock (wall_clock) to clients
Every payload a client renders a capture time from now carries `wall_clock`, a naive ISO-8601 string computed by the existing `date_view::row_display_wall`: the camera's wall clock (true instant + camera offset; the owner's display zone without an offset), with the per-source fallback for unconverted rows. Clients render it verbatim and do no zone math, which is the FileViewer-React #33 / Apollo #37 flip with the rule kept server-side: the drain's permanent `date_utc IS NULL` floor (#120: edited/exported files) would otherwise force every client to carry the per-source legacy conventions forever, and insight prompts already use the same function, so prompt and UI agree by construction. - `/image/metadata` (+ the GPS / date / date-clear mutation responses): `file_wall_clock` — the row's wall, else the filename-class date, else the earliest fs time in the display zone (unindexed files). - `/memories` items and `/photos/gps-summary` photos: `row_wall_clock`. - `get_all_with_gps` returns full rows instead of a 7-tuple that dropped `date_taken_source`, which unconverted rows need. - `date_view::owner_display_zone` resolves prefs -> app default per request. Legacy fields are untouched, so current clients see byte-identical responses (additive; safe to deploy ahead of the client flip, per #120). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f00a309a24
commit
7231383fa6
8 files changed
+259
-93
No files matched your search
@@ -164,6 +164,10 @@ pub struct MemoryItem {
|
||||
pub date_utc: Option<i64>,
|
||||
pub camera_offset_minutes: Option<i32>,
|
||||
pub date_taken_tz_source: Option<String>,
|
||||
/// Capture wall clock to display, naive ISO-8601 (`row_display_wall`):
|
||||
/// the camera's clock, which can differ from the owner's day that
|
||||
/// `created` groups under. Render verbatim (ADR-0001).
|
||||
pub wall_clock: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
@@ -648,6 +652,7 @@ pub fn gather_memory_items(
|
||||
}
|
||||
|
||||
let created = crate::date_view::row_true_instant(&row, display_zone, server_zone);
|
||||
let wall_clock = crate::date_view::row_wall_clock(&row, display_zone, server_zone);
|
||||
memories_with_dates.push((
|
||||
MemoryItem {
|
||||
path: row.file_path,
|
||||
@@ -657,6 +662,7 @@ pub fn gather_memory_items(
|
||||
date_utc: row.date_utc,
|
||||
camera_offset_minutes: row.camera_offset_minutes,
|
||||
date_taken_tz_source: row.date_taken_tz_source,
|
||||
wall_clock,
|
||||
},
|
||||
display_day,
|
||||
));
|
||||
@@ -1141,6 +1147,7 @@ mod tests {
|
||||
date_utc: None,
|
||||
camera_offset_minutes: None,
|
||||
date_taken_tz_source: None,
|
||||
wall_clock: None,
|
||||
},
|
||||
NaiveDate::from_ymd_opt(2024, 1, 15).unwrap(),
|
||||
),
|
||||
@@ -1153,6 +1160,7 @@ mod tests {
|
||||
date_utc: None,
|
||||
camera_offset_minutes: None,
|
||||
date_taken_tz_source: None,
|
||||
wall_clock: None,
|
||||
},
|
||||
NaiveDate::from_ymd_opt(2020, 1, 15).unwrap(),
|
||||
),
|
||||
@@ -1165,6 +1173,7 @@ mod tests {
|
||||
date_utc: None,
|
||||
camera_offset_minutes: None,
|
||||
date_taken_tz_source: None,
|
||||
wall_clock: None,
|
||||
},
|
||||
NaiveDate::from_ymd_opt(2021, 1, 16).unwrap(),
|
||||
),
|
||||
@@ -1506,6 +1515,7 @@ mod tests {
|
||||
date_utc: None,
|
||||
camera_offset_minutes: None,
|
||||
date_taken_tz_source: None,
|
||||
wall_clock: None,
|
||||
};
|
||||
let v: serde_json::Value =
|
||||
serde_json::to_value(&MemoriesResponse { items: vec![item] }).unwrap();
|
||||
|
||||
Reference in new issue
Block a user