diff options
| author | Fuwn <[email protected]> | 2026-02-12 02:38:25 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-02-12 02:38:25 -0800 |
| commit | 7764ba57d12357a8fb6a49f4348841e761e7038c (patch) | |
| tree | 153b27120055741c3166e1338d50a096e20b819c /src | |
| parent | feat(blog): Configurable Notion refresh interval via environment variable (diff) | |
| download | locus-7764ba57d12357a8fb6a49f4348841e761e7038c.tar.xz locus-7764ba57d12357a8fb6a49f4348841e761e7038c.zip | |
fix(blog): Format Notion dates as human-readable strings
Diffstat (limited to 'src')
| -rw-r--r-- | src/notion.rs | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/notion.rs b/src/notion.rs index 74bde89..7f9b413 100644 --- a/src/notion.rs +++ b/src/notion.rs @@ -87,15 +87,10 @@ pub fn extract_relation_ids( } pub fn format_notion_date(iso_date: &str) -> String { - if iso_date.len() < 10 { - return iso_date.to_string(); - } - - let year = &iso_date[0..4]; - let month = &iso_date[5..7]; - let day = &iso_date[8..10]; - - format!("{year}. {month}. {day}.") + chrono::NaiveDate::parse_from_str(iso_date, "%Y-%m-%d").map_or_else( + |_| iso_date.to_string(), + |date| date.format("%B %-d, %Y").to_string(), + ) } pub fn extract_block_plain_text(block: &Block) -> String { |