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"
8source = "registry+https://github.com/rust-lang/crates.io-index" 8source = "registry+https://github.com/rust-lang/crates.io-index"
9checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" 9checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
10 10
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
20[[package]] 11[[package]]
21name = "anstream" 12name = "anstream"
22version = "1.0.0" 13version = "1.0.0"
@@ -85,12 +76,6 @@ version = "1.1.0"
85source = "registry+https://github.com/rust-lang/crates.io-index" 76source = "registry+https://github.com/rust-lang/crates.io-index"
86checksum = "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16" 77checksum = "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16"
87 78
88[[package]]
89name = "autocfg"
90version = "1.5.1"
91source = "registry+https://github.com/rust-lang/crates.io-index"
92checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
93
94[[package]] 79[[package]]
95name = "base64" 80name = "base64"
96version = "0.23.1" 81version = "0.23.1"
@@ -125,12 +110,6 @@ dependencies = [
125 "cpufeatures", 110 "cpufeatures",
126] 111]
127 112
128[[package]]
129name = "bumpalo"
130version = "3.20.3"
131source = "registry+https://github.com/rust-lang/crates.io-index"
132checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"
133
134[[package]] 113[[package]]
135name = "camino" 114name = "camino"
136version = "1.2.6" 115version = "1.2.6"
@@ -156,20 +135,6 @@ version = "1.0.5"
156source = "registry+https://github.com/rust-lang/crates.io-index" 135source = "registry+https://github.com/rust-lang/crates.io-index"
157checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" 136checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
158 137
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
173[[package]] 138[[package]]
174name = "chunked_transfer" 139name = "chunked_transfer"
175version = "1.5.0" 140version = "1.5.0"
@@ -207,7 +172,7 @@ dependencies = [
207 "heck", 172 "heck",
208 "proc-macro2", 173 "proc-macro2",
209 "quote", 174 "quote",
210 "syn 3.0.10", 175 "syn",
211] 176]
212 177
213[[package]] 178[[package]]
@@ -239,12 +204,6 @@ version = "0.4.2"
239source = "registry+https://github.com/rust-lang/crates.io-index" 204source = "registry+https://github.com/rust-lang/crates.io-index"
240checksum = "3d52eff69cd5e647efe296129160853a42795992097e8af39800e1060caeea9b" 205checksum = "3d52eff69cd5e647efe296129160853a42795992097e8af39800e1060caeea9b"
241 206
242[[package]]
243name = "core-foundation-sys"
244version = "0.8.7"
245source = "registry+https://github.com/rust-lang/crates.io-index"
246checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
247
248[[package]] 207[[package]]
249name = "cpufeatures" 208name = "cpufeatures"
250version = "0.3.1" 209version = "0.3.1"
@@ -351,30 +310,6 @@ version = "1.0.7"
351source = "registry+https://github.com/rust-lang/crates.io-index" 310source = "registry+https://github.com/rust-lang/crates.io-index"
352checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 311checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
353 312
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
378[[package]] 313[[package]]
379name = "getrandom" 314name = "getrandom"
380version = "0.4.3" 315version = "0.4.3"
@@ -404,30 +339,6 @@ version = "1.0.3"
404source = "registry+https://github.com/rust-lang/crates.io-index" 339source = "registry+https://github.com/rust-lang/crates.io-index"
405checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" 340checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
406 341
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
431[[package]] 342[[package]]
432name = "indexmap" 343name = "indexmap"
433version = "2.14.2" 344version = "2.14.2"
@@ -484,14 +395,38 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
484checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" 395checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
485 396
486[[package]] 397[[package]]
487name = "js-sys" 398name = "jiff"
488version = "0.3.107" 399version = "1.0.1"
489source = "registry+https://github.com/rust-lang/crates.io-index" 400source = "registry+https://github.com/rust-lang/crates.io-index"
490checksum = "8dc09d2154098bbf4ef54eab6b117a3c24cbbffe94046b16ee6d6d4510584d3a" 401checksum = "ed5d126d72eb017f10b302e73bdeca446bea405ee449af4d9e7866d6b082d83e"
491dependencies = [ 402dependencies = [
492 "cfg-if", 403 "jiff-core",
493 "futures-util", 404 "jiff-static",
494 "wasm-bindgen", 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",
495] 430]
496 431
497[[package]] 432[[package]]
@@ -609,15 +544,6 @@ version = "0.2.2"
609source = "registry+https://github.com/rust-lang/crates.io-index" 544source = "registry+https://github.com/rust-lang/crates.io-index"
610checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" 545checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441"
611 546
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
621[[package]] 547[[package]]
622name = "objc2-core-foundation" 548name = "objc2-core-foundation"
623version = "0.3.2" 549version = "0.3.2"
@@ -678,9 +604,9 @@ dependencies = [
678 "anyhow", 604 "anyhow",
679 "blake3", 605 "blake3",
680 "camino", 606 "camino",
681 "chrono",
682 "clap", 607 "clap",
683 "insta", 608 "insta",
609 "jiff",
684 "minijinja", 610 "minijinja",
685 "notify", 611 "notify",
686 "rayon", 612 "rayon",
@@ -693,12 +619,6 @@ dependencies = [
693 "walkdir", 619 "walkdir",
694] 620]
695 621
696[[package]]
697name = "pin-project-lite"
698version = "0.2.17"
699source = "registry+https://github.com/rust-lang/crates.io-index"
700checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
701
702[[package]] 622[[package]]
703name = "pkg-config" 623name = "pkg-config"
704version = "0.3.34" 624version = "0.3.34"
@@ -718,6 +638,21 @@ dependencies = [
718 "time", 638 "time",
719] 639]
720 640
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
721[[package]] 656[[package]]
722name = "powerfmt" 657name = "powerfmt"
723version = "0.2.1" 658version = "0.2.1"
@@ -796,12 +731,6 @@ dependencies = [
796 "windows-sys", 731 "windows-sys",
797] 732]
798 733
799[[package]]
800name = "rustversion"
801version = "1.0.23"
802source = "registry+https://github.com/rust-lang/crates.io-index"
803checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f"
804
805[[package]] 734[[package]]
806name = "same-file" 735name = "same-file"
807version = "1.0.6" 736version = "1.0.6"
@@ -838,7 +767,7 @@ checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
838dependencies = [ 767dependencies = [
839 "proc-macro2", 768 "proc-macro2",
840 "quote", 769 "quote",
841 "syn 3.0.10", 770 "syn",
842] 771]
843 772
844[[package]] 773[[package]]
@@ -881,29 +810,12 @@ version = "2.7.0"
881source = "registry+https://github.com/rust-lang/crates.io-index" 810source = "registry+https://github.com/rust-lang/crates.io-index"
882checksum = "bbbb5d9659141646ae647b42fe094daf6c6192d1620870b449d9557f748b2daa" 811checksum = "bbbb5d9659141646ae647b42fe094daf6c6192d1620870b449d9557f748b2daa"
883 812
884[[package]]
885name = "slab"
886version = "0.4.12"
887source = "registry+https://github.com/rust-lang/crates.io-index"
888checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
889
890[[package]] 813[[package]]
891name = "strsim" 814name = "strsim"
892version = "0.11.1" 815version = "0.11.1"
893source = "registry+https://github.com/rust-lang/crates.io-index" 816source = "registry+https://github.com/rust-lang/crates.io-index"
894checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" 817checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
895 818
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
907[[package]] 819[[package]]
908name = "syn" 820name = "syn"
909version = "3.0.10" 821version = "3.0.10"
@@ -966,7 +878,7 @@ checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524"
966dependencies = [ 878dependencies = [
967 "proc-macro2", 879 "proc-macro2",
968 "quote", 880 "quote",
969 "syn 3.0.10", 881 "syn",
970] 882]
971 883
972[[package]] 884[[package]]
@@ -1078,50 +990,6 @@ version = "0.11.1+wasi-snapshot-preview1"
1078source = "registry+https://github.com/rust-lang/crates.io-index" 990source = "registry+https://github.com/rust-lang/crates.io-index"
1079checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" 991checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
1080 992
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
1125[[package]] 993[[package]]
1126name = "winapi-util" 994name = "winapi-util"
1127version = "0.1.11" 995version = "0.1.11"
@@ -1131,65 +999,12 @@ dependencies = [
1131 "windows-sys", 999 "windows-sys",
1132] 1000]
1133 1001
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
1169[[package]] 1002[[package]]
1170name = "windows-link" 1003name = "windows-link"
1171version = "0.2.1" 1004version = "0.2.1"
1172source = "registry+https://github.com/rust-lang/crates.io-index" 1005source = "registry+https://github.com/rust-lang/crates.io-index"
1173checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" 1006checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
1174 1007
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
1193[[package]] 1008[[package]]
1194name = "windows-sys" 1009name = "windows-sys"
1195version = "0.61.2" 1010version = "0.61.2"
Cargo.toml +1 −1
@@ -33,7 +33,7 @@ path = "src/main.rs"
33# Parsing / model 33# Parsing / model
34serde = { version = "1", features = ["derive"] } 34serde = { version = "1", features = ["derive"] }
35serde_json = "1" 35serde_json = "1"
36chrono = { version = "0.4", features = ["serde"] } 36jiff = { version = "1", default-features = false, features = ["std", "serde"] }
37camino = { version = "1", features = ["serde1"] } 37camino = { version = "1", features = ["serde1"] }
38 38
39# Pipeline 39# Pipeline
src/model.rs +3 −3
@@ -10,7 +10,7 @@
10//! snapshots share one representation (spec §4, §5). 10//! snapshots share one representation (spec §4, §5).
11 11
12use camino::Utf8PathBuf; 12use camino::Utf8PathBuf;
13use chrono::NaiveDateTime; 13use jiff::civil::DateTime;
14use serde::{Deserialize, Serialize}; 14use serde::{Deserialize, Serialize};
15 15
16/// Content hash of raw source bytes. blake3 (spec §4.1). Serialized as hex. 16/// Content hash of raw source bytes. blake3 (spec §4.1). Serialized as hex.
@@ -255,7 +255,7 @@ pub enum LinkTarget {
255pub struct Timestamp { 255pub struct Timestamp {
256 /// `<...>` vs `[...]`. 256 /// `<...>` vs `[...]`.
257 pub active: bool, 257 pub active: bool,
258 pub start: NaiveDateTime, 258 pub start: DateTime,
259 pub end: Option<NaiveDateTime>, 259 pub end: Option<DateTime>,
260 pub has_time: bool, 260 pub has_time: bool,
261} 261}
src/parser.rs +9 −9
@@ -24,7 +24,7 @@
24//! org's exporter leaves it alone: it does not recalculate on export either. 24//! org's exporter leaves it alone: it does not recalculate on export either.
25 25
26use camino::Utf8Path; 26use camino::Utf8Path;
27use chrono::{NaiveDate, NaiveDateTime, NaiveTime}; 27use jiff::civil::{Date, DateTime, Time};
28 28
29use crate::model::{ 29use crate::model::{
30 BlockParams, Bullet, Checkbox, ContentHash, Document, Element, Heading, Keywords, Link, 30 BlockParams, Bullet, Checkbox, ContentHash, Document, Element, Heading, Keywords, Link,
@@ -1390,7 +1390,7 @@ fn try_timestamp(chars: &[char], i: usize) -> Option<(Object, usize)> {
1390fn parse_stamp( 1390fn parse_stamp(
1391 chars: &[char], 1391 chars: &[char],
1392 i: usize, 1392 i: usize,
1393) -> Option<(NaiveDateTime, Option<NaiveDateTime>, bool, usize)> { 1393) -> Option<(DateTime, Option<DateTime>, bool, usize)> {
1394 let open = *chars.get(i)?; 1394 let open = *chars.get(i)?;
1395 let close = match open { 1395 let close = match open {
1396 '<' => '>', 1396 '<' => '>',
@@ -1400,10 +1400,10 @@ fn parse_stamp(
1400 let end = (i + 1..chars.len()).find(|&k| chars[k] == close)?; 1400 let end = (i + 1..chars.len()).find(|&k| chars[k] == close)?;
1401 let body: String = chars[i + 1..end].iter().collect(); 1401 let body: String = chars[i + 1..end].iter().collect();
1402 let mut parts = body.split_whitespace(); 1402 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()?;
1404 1404
1405 let mut has_time = false; 1405 let mut has_time = false;
1406 let mut start_time = NaiveTime::MIN; 1406 let mut start_time = Time::midnight();
1407 let mut end_time = None; 1407 let mut end_time = None;
1408 for part in parts { 1408 for part in parts {
1409 if let Some((from, to)) = parse_time_spec(part) { 1409 if let Some((from, to)) = parse_time_spec(part) {
@@ -1413,22 +1413,22 @@ fn parse_stamp(
1413 } 1413 }
1414 } 1414 }
1415 Some(( 1415 Some((
1416 date.and_time(start_time), 1416 date.to_datetime(start_time),
1417 end_time.map(|t| date.and_time(t)), 1417 end_time.map(|t| date.to_datetime(t)),
1418 has_time, 1418 has_time,
1419 end + 1, 1419 end + 1,
1420 )) 1420 ))
1421} 1421}
1422 1422
1423/// `HH:MM` or `HH:MM-HH:MM`. 1423/// `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>)> {
1425 let (from, to) = match s.split_once('-') { 1425 let (from, to) = match s.split_once('-') {
1426 Some((a, b)) => (a, Some(b)), 1426 Some((a, b)) => (a, Some(b)),
1427 None => (s, None), 1427 None => (s, None),
1428 }; 1428 };
1429 let from = NaiveTime::parse_from_str(from, "%H:%M").ok()?; 1429 let from = Time::strptime("%H:%M", from).ok()?;
1430 let to = match to { 1430 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()?),
1432 None => None, 1432 None => None,
1433 }; 1433 };
1434 Some((from, to)) 1434 Some((from, to))
src/render.rs +7 −7
@@ -889,11 +889,11 @@ fn timestamp_html(ts: &crate::model::Timestamp) -> String {
889 } else { 889 } else {
890 "timestamp inactive" 890 "timestamp inactive"
891 }; 891 };
892 let one = |dt: &chrono::NaiveDateTime, text: String| { 892 let one = |dt: &jiff::civil::DateTime, text: String| {
893 let attr = if ts.has_time { 893 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()
895 } else { 895 } else {
896 dt.format("%Y-%m-%d").to_string() 896 dt.strftime("%Y-%m-%d").to_string()
897 }; 897 };
898 format!( 898 format!(
899 "<time class=\"{class}\" datetime=\"{}\">{}</time>", 899 "<time class=\"{class}\" datetime=\"{}\">{}</time>",
@@ -901,11 +901,11 @@ fn timestamp_html(ts: &crate::model::Timestamp) -> String {
901 escape_html(&text) 901 escape_html(&text)
902 ) 902 )
903 }; 903 };
904 let text_of = |dt: &chrono::NaiveDateTime| { 904 let text_of = |dt: &jiff::civil::DateTime| {
905 if ts.has_time { 905 if ts.has_time {
906 dt.format("%Y-%m-%d %H:%M").to_string() 906 dt.strftime("%Y-%m-%d %H:%M").to_string()
907 } else { 907 } else {
908 dt.format("%Y-%m-%d").to_string() 908 dt.strftime("%Y-%m-%d").to_string()
909 } 909 }
910 }; 910 };
911 911
@@ -913,7 +913,7 @@ fn timestamp_html(ts: &crate::model::Timestamp) -> String {
913 if let Some(end) = &ts.end { 913 if let Some(end) = &ts.end {
914 out.push_str("&#8211;"); 914 out.push_str("&#8211;");
915 let text = if end.date() == ts.start.date() && ts.has_time { 915 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()
917 } else { 917 } else {
918 text_of(end) 918 text_of(end)
919 }; 919 };
src/template.rs +3 −4
@@ -540,7 +540,7 @@ fn add_filters(env: &mut Environment<'static>, base_url: &str) {
540 format!("cannot read a date out of {raw:?} for an RSS pubDate"), 540 format!("cannot read a date out of {raw:?} for an RSS pubDate"),
541 ) 541 )
542 })?; 542 })?;
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| {
544 minijinja::Error::new( 544 minijinja::Error::new(
545 minijinja::ErrorKind::InvalidOperation, 545 minijinja::ErrorKind::InvalidOperation,
546 format!("{iso} is not a valid date: {e}"), 546 format!("{iso} is not a valid date: {e}"),
@@ -548,9 +548,8 @@ fn add_filters(env: &mut Environment<'static>, base_url: &str) {
548 })?; 548 })?;
549 // Org dates carry no timezone, so midnight UTC is the honest reading of one. 549 // Org dates carry no timezone, so midnight UTC is the honest reading of one.
550 Ok(date 550 Ok(date
551 .and_hms_opt(0, 0, 0) 551 .to_datetime(jiff::civil::Time::midnight())
552 .expect("midnight is a valid time") 552 .strftime("%a, %d %b %Y %H:%M:%S +0000")
553 .format("%a, %d %b %Y %H:%M:%S +0000")
554 .to_string()) 553 .to_string())
555 }); 554 });
556} 555}