fix: increases specificity of dates so entries are still correctly ordered within the same day

This commit is contained in:
Lewis Wynne 2026-04-09 20:53:23 +01:00
parent e7cf98ae17
commit 73823e84ec
4 changed files with 6 additions and 5 deletions

2
Cargo.lock generated
View file

@ -452,7 +452,7 @@ dependencies = [
[[package]]
name = "guestbook"
version = "0.2.0"
version = "0.2.1"
dependencies = [
"axum",
"chrono",

View file

@ -1,6 +1,6 @@
[package]
name = "guestbook"
version = "0.2.0"
version = "0.2.1"
edition = "2021"
description = "A configurable web guestbook made to be easy to use, with entries in plain text files, options for honeypots and captchas to deter spam, and moderation via Telegram bot."
license = "MIT"

View file

@ -85,7 +85,7 @@ fn render_entry(entry: &Entry, config: &Config) -> String {
};
let mut header = format!(
"<span class=\"entry-header\">{} - <span class=\"entry-name\">{}</span>",
entry.meta.date, name
&entry.meta.date[..10], name
);
if config.enable_website_links && !entry.meta.website.is_empty() {
let website = escape_html(&entry.meta.website);

View file

@ -117,8 +117,9 @@ async fn submit(
}
let short_id = &Uuid::new_v4().to_string()[..8];
let date = chrono::Utc::now().format("%Y-%m-%d").to_string();
let filename = format!("{date}-{short_id}.txt");
let date = chrono::Utc::now().format("%Y-%m-%dT%H:%M:%S").to_string();
let date_short = &date[..10];
let filename = format!("{date_short}-{short_id}.txt");
let entry = Entry {
id: filename.trim_end_matches(".txt").to_string(),