Reproduction:
use jiff::civil;
fn main() -> anyhow::Result<()> {
let zdt =
civil::date(-2025, 1, 13).at(5, 0, 0, 0).in_tz("America/New_York")?;
println!("{}", zdt.strftime("%_6Y"));
Ok(())
}
Has this output:
But it should be:
Note that there is also an issue when zero padding is used. Specifically, this program:
use jiff::civil;
fn main() -> anyhow::Result<()> {
let zdt =
civil::date(-2025, 1, 13).at(5, 0, 0, 0).in_tz("America/New_York")?;
println!("{}", zdt.strftime("%06Y"));
Ok(())
}
Has this output:
But it should be:
For reference, GNU date behaves as expected:
$ date +'%06Y' -d '@-99999999999'
-01199
$ date +'%_6Y' -d '@-99999999999'
-1199
Reproduction:
Has this output:
But it should be:
Note that there is also an issue when zero padding is used. Specifically, this program:
Has this output:
But it should be:
For reference, GNU date behaves as expected: