server: fix date parsing w/ TZ and cal widget highlight
This commit is contained in:
parent
030d1c2ebe
commit
33c0a106b7
@ -2157,28 +2157,28 @@ mod tests {
|
||||
let meta = extract_calendar_metadata_from_mail(&parsed, &body);
|
||||
// Assert detection as Google Calendar
|
||||
assert!(meta.is_google_calendar_event);
|
||||
// Debug: print the rendered HTML for inspection
|
||||
let html = meta.body_html.expect("body_html");
|
||||
|
||||
// Print event date info for debugging
|
||||
for part in parsed.subparts.iter() {
|
||||
if part.ctype.mimetype == TEXT_CALENDAR {
|
||||
if let Ok(ical) = part.get_body() {
|
||||
println!("ICAL data: {}", ical);
|
||||
if let Some(start) = ical.lines().find(|l| l.starts_with("DTSTART:")) {
|
||||
println!("Start date: {}", start);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
println!("Rendered HTML: {}", html);
|
||||
// Check that the calendar table highlights Thursday, not Friday
|
||||
// Look for a table header row with days of week (allow whitespace)
|
||||
let thursday_idx = html
|
||||
.find(">\n Thu<")
|
||||
.or_else(|| html.find(">Thu<"))
|
||||
.expect("Should have a Thursday column");
|
||||
let friday_idx = html
|
||||
.find(">\n Fri<")
|
||||
.or_else(|| html.find(">Fri<"))
|
||||
.expect("Should have a Friday column");
|
||||
// Find the first highlighted cell (background:#ffd700)
|
||||
let highlight_idx = html
|
||||
.find("background:#ffd700")
|
||||
.expect("Should highlight a day");
|
||||
// The highlight should be closer to Thursday than Friday
|
||||
assert!(
|
||||
highlight_idx > thursday_idx && highlight_idx < friday_idx,
|
||||
"Thursday should be highlighted, not Friday"
|
||||
);
|
||||
|
||||
// Look for September 11 (Thursday) being highlighted
|
||||
// The calendar should show Sept 11 highlighted with background:#ffd700 and the correct data-event-day
|
||||
assert!(html.contains(r#"data-event-day="2025-09-11""#));
|
||||
assert!(html.contains(r#"background:#ffd700"#));
|
||||
|
||||
// Since 1:00 AM UTC on Friday 9/12 is 6:00 PM PDT on Thursday 9/11, verify times are correct
|
||||
assert!(html.contains("6:00 PM Thu Sep 11, 2025"));
|
||||
}
|
||||
use super::*;
|
||||
#[test]
|
||||
|
||||
@ -74,13 +74,7 @@
|
||||
{% for week in all_days|batch(7) %}
|
||||
<tr>
|
||||
{% for day in week %}
|
||||
{% if event_days.contains(day) && today.is_some() && today.unwrap() == day %}
|
||||
<td
|
||||
data-event-day="{{ day.format("%Y-%m-%d") }}"
|
||||
style="background:#ffd700; color:#222; font-weight:bold; border:2px solid #2196f3; border-radius:4px; text-align:center; box-shadow:0 0 0 2px #2196f3;">
|
||||
{{ day.day() }}
|
||||
</td>
|
||||
{% elif event_days.contains(day) %}
|
||||
{% if event_days.contains(day) %}
|
||||
<td
|
||||
data-event-day="{{ day.format("%Y-%m-%d") }}"
|
||||
style="background:#ffd700; color:#222; font-weight:bold; border:1px solid #aaa; border-radius:4px; text-align:center;">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user