Zola version: 0.10.1
There should be an error message that the date string is badly formatted, instead of a cryptic error message.
$ env RUST_BACKTRACE=1 zola serve (base)
Building site...
-> Creating 15 pages (0 orphan), 1 sections, and processing 0 images
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /private/tmp/rust-20200227-78610-djkaw6/rustc-1.41.1-src/src/libcore/macros/mod.rs:15:40
stack backtrace:
0: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
1: core::fmt::write
2: std::io::Write::write_fmt
3: std::panicking::default_hook::{{closure}}
4: std::panicking::rust_panic_with_hook
5: rust_begin_unwind
6: core::panicking::panic_fmt
7: core::panicking::panic
8: library::sorting::sort_actual_pages_by_date
9: rayon::slice::quicksort::shift_tail
10: rayon::slice::quicksort::recurse
11: site::Site::render_rss_feed
12: site::Site::build
13: zola::cmd::serve::create_new_site
14: zola::cmd::serve::serve
15: zola::main
16: std::rt::lang_start::{{closure}}
17: main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Make a page with a badly formatted date, like so (it should have a +00:00 at the end).
+++
title = "Building 1:1 Scale Minecraft Replicas with Google Maps"
template = "post.html"
date = 2020-04-12T19:52:46
+++
How are you supposed to generate the type of date string that zola wants? On MacOS, the date command doesn't have an ISO8601 mode, and Python datetime.now().isoformat() outputs something that Zola doesn't understand (and makes it panic).
Hm the panic definitely needs to be fixed.
As for the format, see the TOML spec: https://github.com/toml-lang/toml#user-content-offset-date-time but your example should work according to https://github.com/toml-lang/toml#local-date-time
The documentation does specify the accepted date formats, which are unfortunately much stricter than TOML.
# The date of the post.
# Two formats are allowed: YYYY-MM-DD (2012-10-02) and RFC3339 (2002-10-02T15:00:00Z).
As for Python, you need to specify a tzinfo to get timestamps with a timezone. E.g.
>>> from datetime import *
>>> datetime.now(timezone(timedelta(hours=-7))).replace(microsecond=0).isoformat()
'2020-06-05T15:12:15-07:00'
And for BSD date, use date +%Y-%m-%dT%H:%M:%S%z.
Ideally the front-matter should support any date allowed by the TOML spec. The only restriction being when putting the date in the filename for Windows reasons.
I agree that would be nice. I don't know how to use the toml parser to do that, though. And chrono doesn't support parsing dates without a format. Maybe we should have a bunch of allowed strftime formats that are tried one by one?
Disregard my last comment. All that was really missing was RFC3339 with the timezone removed. The PR now addresses that.