Commit dbdc3aaec7

dbdc3aaec78b7e1aed395d71602b79a2f4637d4f

parent: b5f7717bb3

Verified · cmc ci/pages: success ci/test: success

cmc <hello@cleberg.net> · 2026-11-20 19:19 UTC

Replace chrono with jiff

chrono is unmaintained (RUSTSEC-2026-0543). Serialized timestamps keep the same form, so snapshots and the parse cache are unchanged.

Closes #11

Layout: unified · split

Cargo.lock +49 −234
@@ -8,15 +8,6 @@ version = "2.0.1"
88source = "registry+https://github.com/rust-lang/crates.io-index"
99checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
1010
11[[package]]
12name = "android_system_properties"
13version = "0.1.6"
14source = "registry+https://github.com/rust-lang/crates.io-index"
15checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc"
16dependencies = [
17 "libc",
18]
19
2011[[package]]
2112name = "anstream"
2213version = "1.0.0"
@@ -85,12 +76,6 @@ version = "1.1.0"
8576source = "registry+https://github.com/rust-lang/crates.io-index"
8677checksum = "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16"
8778
88[[package]]
89name = "autocfg"
90version = "1.5.1"
91source = "registry+https://github.com/rust-lang/crates.io-index"
92checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
93
9479[[package]]
9580name = "base64"
9681version = "0.23.1"
@@ -125,12 +110,6 @@ dependencies = [
125110 "cpufeatures",
126111]
127112
128[[package]]
129name = "bumpalo"
130version = "3.20.3"
131source = "registry+https://github.com/rust-lang/crates.io-index"
132checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"
133
134113[[package]]
135114name = "camino"
136115version = "1.2.6"
@@ -156,20 +135,6 @@ version = "1.0.5"
156135source = "registry+https://github.com/rust-lang/crates.io-index"
157136checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
158137
159[[package]]
160name = "chrono"
161version = "0.4.45"
162source = "registry+https://github.com/rust-lang/crates.io-index"
163checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327"
164dependencies = [
165 "iana-time-zone",
166 "js-sys",
167 "num-traits",
168 "serde",
169 "wasm-bindgen",
170 "windows-link",
171]
172
173138[[package]]
174139name = "chunked_transfer"
175140version = "1.5.0"
@@ -207,7 +172,7 @@ dependencies = [
207172 "heck",
208173 "proc-macro2",
209174 "quote",
210 "syn 3.0.10",
175 "syn",
211176]
212177
213178[[package]]
@@ -239,12 +204,6 @@ version = "0.4.2"
239204source = "registry+https://github.com/rust-lang/crates.io-index"
240205checksum = "3d52eff69cd5e647efe296129160853a42795992097e8af39800e1060caeea9b"
241206
242[[package]]
243name = "core-foundation-sys"
244version = "0.8.7"
245source = "registry+https://github.com/rust-lang/crates.io-index"
246checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
247
248207[[package]]
249208name = "cpufeatures"
250209version = "0.3.1"
@@ -351,30 +310,6 @@ version = "1.0.7"
351310source = "registry+https://github.com/rust-lang/crates.io-index"
352311checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
353312
354[[package]]
355name = "futures-core"
356version = "0.3.34"
357source = "registry+https://github.com/rust-lang/crates.io-index"
358checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e"
359
360[[package]]
361name = "futures-task"
362version = "0.3.34"
363source = "registry+https://github.com/rust-lang/crates.io-index"
364checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd"
365
366[[package]]
367name = "futures-util"
368version = "0.3.34"
369source = "registry+https://github.com/rust-lang/crates.io-index"
370checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc"
371dependencies = [
372 "futures-core",
373 "futures-task",
374 "pin-project-lite",
375 "slab",
376]
377
378313[[package]]
379314name = "getrandom"
380315version = "0.4.3"
@@ -404,30 +339,6 @@ version = "1.0.3"
404339source = "registry+https://github.com/rust-lang/crates.io-index"
405340checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
406341
407[[package]]
408name = "iana-time-zone"
409version = "0.1.65"
410source = "registry+https://github.com/rust-lang/crates.io-index"
411checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470"
412dependencies = [
413 "android_system_properties",
414 "core-foundation-sys",
415 "iana-time-zone-haiku",
416 "js-sys",
417 "log",
418 "wasm-bindgen",
419 "windows-core",
420]
421
422[[package]]
423name = "iana-time-zone-haiku"
424version = "0.1.2"
425source = "registry+https://github.com/rust-lang/crates.io-index"
426checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
427dependencies = [
428 "cc",
429]
430
431342[[package]]
432343name = "indexmap"
433344version = "2.14.2"
@@ -484,14 +395,38 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
484395checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
485396
486397[[package]]
487name = "js-sys"
488version = "0.3.107"
398name = "jiff"
399version = "1.0.1"
489400source = "registry+https://github.com/rust-lang/crates.io-index"
490checksum = "8dc09d2154098bbf4ef54eab6b117a3c24cbbffe94046b16ee6d6d4510584d3a"
401checksum = "ed5d126d72eb017f10b302e73bdeca446bea405ee449af4d9e7866d6b082d83e"
491402dependencies = [
492 "cfg-if",
493 "futures-util",
494 "wasm-bindgen",
403 "jiff-core",
404 "jiff-static",
405 "log",
406 "portable-atomic",
407 "portable-atomic-util",
408 "serde_core",
409]
410
411[[package]]
412name = "jiff-core"
413version = "1.0.1"
414source = "registry+https://github.com/rust-lang/crates.io-index"
415checksum = "b6b46a105a9874634dd96231021526bf24ca04955a5998c59a9c7666e634b7b8"
416dependencies = [
417 "log",
418]
419
420[[package]]
421name = "jiff-static"
422version = "1.0.1"
423source = "registry+https://github.com/rust-lang/crates.io-index"
424checksum = "c0127e9bde3c6130d6169e7d8d68676e4be69c4bf7573c308b6f960a5089c428"
425dependencies = [
426 "jiff-core",
427 "proc-macro2",
428 "quote",
429 "syn",
495430]
496431
497432[[package]]
@@ -609,15 +544,6 @@ version = "0.2.2"
609544source = "registry+https://github.com/rust-lang/crates.io-index"
610545checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441"
611546
612[[package]]
613name = "num-traits"
614version = "0.2.19"
615source = "registry+https://github.com/rust-lang/crates.io-index"
616checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
617dependencies = [
618 "autocfg",
619]
620
621547[[package]]
622548name = "objc2-core-foundation"
623549version = "0.3.2"
@@ -678,9 +604,9 @@ dependencies = [
678604 "anyhow",
679605 "blake3",
680606 "camino",
681 "chrono",
682607 "clap",
683608 "insta",
609 "jiff",
684610 "minijinja",
685611 "notify",
686612 "rayon",
@@ -693,12 +619,6 @@ dependencies = [
693619 "walkdir",
694620]
695621
696[[package]]
697name = "pin-project-lite"
698version = "0.2.17"
699source = "registry+https://github.com/rust-lang/crates.io-index"
700checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
701
702622[[package]]
703623name = "pkg-config"
704624version = "0.3.34"
@@ -718,6 +638,21 @@ dependencies = [
718638 "time",
719639]
720640
641[[package]]
642name = "portable-atomic"
643version = "1.15.0"
644source = "registry+https://github.com/rust-lang/crates.io-index"
645checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"
646
647[[package]]
648name = "portable-atomic-util"
649version = "0.2.8"
650source = "registry+https://github.com/rust-lang/crates.io-index"
651checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715"
652dependencies = [
653 "portable-atomic",
654]
655
721656[[package]]
722657name = "powerfmt"
723658version = "0.2.1"
@@ -796,12 +731,6 @@ dependencies = [
796731 "windows-sys",
797732]
798733
799[[package]]
800name = "rustversion"
801version = "1.0.23"
802source = "registry+https://github.com/rust-lang/crates.io-index"
803checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f"
804
805734[[package]]
806735name = "same-file"
807736version = "1.0.6"
@@ -838,7 +767,7 @@ checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
838767dependencies = [
839768 "proc-macro2",
840769 "quote",
841 "syn 3.0.10",
770 "syn",
842771]
843772
844773[[package]]
@@ -881,29 +810,12 @@ version = "2.7.0"
881810source = "registry+https://github.com/rust-lang/crates.io-index"
882811checksum = "bbbb5d9659141646ae647b42fe094daf6c6192d1620870b449d9557f748b2daa"
883812
884[[package]]
885name = "slab"
886version = "0.4.12"
887source = "registry+https://github.com/rust-lang/crates.io-index"
888checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
889
890813[[package]]
891814name = "strsim"
892815version = "0.11.1"
893816source = "registry+https://github.com/rust-lang/crates.io-index"
894817checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
895818
896[[package]]
897name = "syn"
898version = "2.0.119"
899source = "registry+https://github.com/rust-lang/crates.io-index"
900checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
901dependencies = [
902 "proc-macro2",
903 "quote",
904 "unicode-ident",
905]
906
907819[[package]]
908820name = "syn"
909821version = "3.0.10"
@@ -966,7 +878,7 @@ checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524"
966878dependencies = [
967879 "proc-macro2",
968880 "quote",
969 "syn 3.0.10",
881 "syn",
970882]
971883
972884[[package]]
@@ -1078,50 +990,6 @@ version = "0.11.1+wasi-snapshot-preview1"
1078990source = "registry+https://github.com/rust-lang/crates.io-index"
1079991checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
1080992
1081[[package]]
1082name = "wasm-bindgen"
1083version = "0.2.130"
1084source = "registry+https://github.com/rust-lang/crates.io-index"
1085checksum = "a0181c14ddd6c7b8b0b0132a5f1ea2f32be0d893cd3ea97b6e3b28886b8a3d1c"
1086dependencies = [
1087 "cfg-if",
1088 "rustversion",
1089 "wasm-bindgen-macro",
1090 "wasm-bindgen-shared",
1091]
1092
1093[[package]]
1094name = "wasm-bindgen-macro"
1095version = "0.2.130"
1096source = "registry+https://github.com/rust-lang/crates.io-index"
1097checksum = "6e931a02a39abdbf66966fc35902b5ed58344750a70885bed4ebb3d8eaf28ed9"
1098dependencies = [
1099 "quote",
1100 "wasm-bindgen-macro-support",
1101]
1102
1103[[package]]
1104name = "wasm-bindgen-macro-support"
1105version = "0.2.130"
1106source = "registry+https://github.com/rust-lang/crates.io-index"
1107checksum = "2ca4b54280e455bd831e33a6b8e734baf432fe63fbc35c42ac14ce67a043a53a"
1108dependencies = [
1109 "bumpalo",
1110 "proc-macro2",
1111 "quote",
1112 "syn 3.0.10",
1113 "wasm-bindgen-shared",
1114]
1115
1116[[package]]
1117name = "wasm-bindgen-shared"
1118version = "0.2.130"
1119source = "registry+https://github.com/rust-lang/crates.io-index"
1120checksum = "3b1f9c3798725016c6ee5f2f57869ec0831e8bbc0ab0310a86e787e97f41389e"
1121dependencies = [
1122 "unicode-ident",
1123]
1124
1125993[[package]]
1126994name = "winapi-util"
1127995version = "0.1.11"
@@ -1131,65 +999,12 @@ dependencies = [
1131999 "windows-sys",
11321000]
11331001
1134[[package]]
1135name = "windows-core"
1136version = "0.62.2"
1137source = "registry+https://github.com/rust-lang/crates.io-index"
1138checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb"
1139dependencies = [
1140 "windows-implement",
1141 "windows-interface",
1142 "windows-link",
1143 "windows-result",
1144 "windows-strings",
1145]
1146
1147[[package]]
1148name = "windows-implement"
1149version = "0.60.2"
1150source = "registry+https://github.com/rust-lang/crates.io-index"
1151checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf"
1152dependencies = [
1153 "proc-macro2",
1154 "quote",
1155 "syn 2.0.119",
1156]
1157
1158[[package]]
1159name = "windows-interface"
1160version = "0.59.3"
1161source = "registry+https://github.com/rust-lang/crates.io-index"
1162checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358"
1163dependencies = [
1164 "proc-macro2",
1165 "quote",
1166 "syn 2.0.119",
1167]
1168
11691002[[package]]
11701003name = "windows-link"
11711004version = "0.2.1"
11721005source = "registry+https://github.com/rust-lang/crates.io-index"
11731006checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
11741007
1175[[package]]
1176name = "windows-result"
1177version = "0.4.1"
1178source = "registry+https://github.com/rust-lang/crates.io-index"
1179checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5"
1180dependencies = [
1181 "windows-link",
1182]
1183
1184[[package]]
1185name = "windows-strings"
1186version = "0.5.1"
1187source = "registry+https://github.com/rust-lang/crates.io-index"
1188checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091"
1189dependencies = [
1190 "windows-link",
1191]
1192
11931008[[package]]
11941009name = "windows-sys"
11951010version = "0.61.2"
Cargo.toml +1 −1
@@ -33,7 +33,7 @@ path = "src/main.rs"
3333# Parsing / model
3434serde = { version = "1", features = ["derive"] }
3535serde_json = "1"
36chrono = { version = "0.4", features = ["serde"] }
36jiff = { version = "1", default-features = false, features = ["std", "serde"] }
3737camino = { version = "1", features = ["serde1"] }
3838
3939# Pipeline
src/model.rs +3 −3
@@ -10,7 +10,7 @@
1010//! snapshots share one representation (spec §4, §5).
1111
1212use camino::Utf8PathBuf;
13use chrono::NaiveDateTime;
13use jiff::civil::DateTime;
1414use serde::{Deserialize, Serialize};
1515
1616/// Content hash of raw source bytes. blake3 (spec §4.1). Serialized as hex.
@@ -255,7 +255,7 @@ pub enum LinkTarget {
255255pub struct Timestamp {
256256 /// `<...>` vs `[...]`.
257257 pub active: bool,
258 pub start: NaiveDateTime,
259 pub end: Option<NaiveDateTime>,
258 pub start: DateTime,
259 pub end: Option<DateTime>,
260260 pub has_time: bool,
261261}
src/parser.rs +9 −9
@@ -24,7 +24,7 @@
2424//! org's exporter leaves it alone: it does not recalculate on export either.
2525
2626use camino::Utf8Path;
27use chrono::{NaiveDate, NaiveDateTime, NaiveTime};
27use jiff::civil::{Date, DateTime, Time};
2828
2929use crate::model::{
3030 BlockParams, Bullet, Checkbox, ContentHash, Document, Element, Heading, Keywords, Link,
@@ -1390,7 +1390,7 @@ fn try_timestamp(chars: &[char], i: usize) -> Option<(Object, usize)> {
13901390fn parse_stamp(
13911391 chars: &[char],
13921392 i: usize,
1393) -> Option<(NaiveDateTime, Option<NaiveDateTime>, bool, usize)> {
1393) -> Option<(DateTime, Option<DateTime>, bool, usize)> {
13941394 let open = *chars.get(i)?;
13951395 let close = match open {
13961396 '<' => '>',
@@ -1400,10 +1400,10 @@ fn parse_stamp(
14001400 let end = (i + 1..chars.len()).find(|&k| chars[k] == close)?;
14011401 let body: String = chars[i + 1..end].iter().collect();
14021402 let mut parts = body.split_whitespace();
1403 let date = NaiveDate::parse_from_str(parts.next()?, "%Y-%m-%d").ok()?;
1403 let date = Date::strptime("%Y-%m-%d", parts.next()?).ok()?;
14041404
14051405 let mut has_time = false;
1406 let mut start_time = NaiveTime::MIN;
1406 let mut start_time = Time::midnight();
14071407 let mut end_time = None;
14081408 for part in parts {
14091409 if let Some((from, to)) = parse_time_spec(part) {
@@ -1413,22 +1413,22 @@ fn parse_stamp(
14131413 }
14141414 }
14151415 Some((
1416 date.and_time(start_time),
1417 end_time.map(|t| date.and_time(t)),
1416 date.to_datetime(start_time),
1417 end_time.map(|t| date.to_datetime(t)),
14181418 has_time,
14191419 end + 1,
14201420 ))
14211421}
14221422
14231423/// `HH:MM` or `HH:MM-HH:MM`.
1424fn parse_time_spec(s: &str) -> Option<(NaiveTime, Option<NaiveTime>)> {
1424fn parse_time_spec(s: &str) -> Option<(Time, Option<Time>)> {
14251425 let (from, to) = match s.split_once('-') {
14261426 Some((a, b)) => (a, Some(b)),
14271427 None => (s, None),
14281428 };
1429 let from = NaiveTime::parse_from_str(from, "%H:%M").ok()?;
1429 let from = Time::strptime("%H:%M", from).ok()?;
14301430 let to = match to {
1431 Some(b) => Some(NaiveTime::parse_from_str(b, "%H:%M").ok()?),
1431 Some(b) => Some(Time::strptime("%H:%M", b).ok()?),
14321432 None => None,
14331433 };
14341434 Some((from, to))
src/render.rs +7 −7
@@ -889,11 +889,11 @@ fn timestamp_html(ts: &crate::model::Timestamp) -> String {
889889 } else {
890890 "timestamp inactive"
891891 };
892 let one = |dt: &chrono::NaiveDateTime, text: String| {
892 let one = |dt: &jiff::civil::DateTime, text: String| {
893893 let attr = if ts.has_time {
894 dt.format("%Y-%m-%dT%H:%M").to_string()
894 dt.strftime("%Y-%m-%dT%H:%M").to_string()
895895 } else {
896 dt.format("%Y-%m-%d").to_string()
896 dt.strftime("%Y-%m-%d").to_string()
897897 };
898898 format!(
899899 "<time class=\"{class}\" datetime=\"{}\">{}</time>",
@@ -901,11 +901,11 @@ fn timestamp_html(ts: &crate::model::Timestamp) -> String {
901901 escape_html(&text)
902902 )
903903 };
904 let text_of = |dt: &chrono::NaiveDateTime| {
904 let text_of = |dt: &jiff::civil::DateTime| {
905905 if ts.has_time {
906 dt.format("%Y-%m-%d %H:%M").to_string()
906 dt.strftime("%Y-%m-%d %H:%M").to_string()
907907 } else {
908 dt.format("%Y-%m-%d").to_string()
908 dt.strftime("%Y-%m-%d").to_string()
909909 }
910910 };
911911
@@ -913,7 +913,7 @@ fn timestamp_html(ts: &crate::model::Timestamp) -> String {
913913 if let Some(end) = &ts.end {
914914 out.push_str("&#8211;");
915915 let text = if end.date() == ts.start.date() && ts.has_time {
916 end.format("%H:%M").to_string()
916 end.strftime("%H:%M").to_string()
917917 } else {
918918 text_of(end)
919919 };
src/template.rs +3 −4
@@ -540,7 +540,7 @@ fn add_filters(env: &mut Environment<'static>, base_url: &str) {
540540 format!("cannot read a date out of {raw:?} for an RSS pubDate"),
541541 )
542542 })?;
543 let date = chrono::NaiveDate::parse_from_str(&iso, "%Y-%m-%d").map_err(|e| {
543 let date = jiff::civil::Date::strptime("%Y-%m-%d", &iso).map_err(|e| {
544544 minijinja::Error::new(
545545 minijinja::ErrorKind::InvalidOperation,
546546 format!("{iso} is not a valid date: {e}"),
@@ -548,9 +548,8 @@ fn add_filters(env: &mut Environment<'static>, base_url: &str) {
548548 })?;
549549 // Org dates carry no timezone, so midnight UTC is the honest reading of one.
550550 Ok(date
551 .and_hms_opt(0, 0, 0)
552 .expect("midnight is a valid time")
553 .format("%a, %d %b %Y %H:%M:%S +0000")
551 .to_datetime(jiff::civil::Time::midnight())
552 .strftime("%a, %d %b %Y %H:%M:%S +0000")
554553 .to_string())
555554 });
556555}