249
submitted 8 months ago* (last edited 8 months ago) by snaggen@programming.dev to c/programmer_humor@programming.dev

fjärrinlägg från: https://programming.dev/post/10803496

TIL: Sweden had February 30 in 1712 https://en.wikipedia.org/wiki/1712_in_Sweden , so I decided to see how chrono handled that.

use chrono::TimeZone;
use chrono_tz::Europe::Stockholm;

fn main() {
    let feb30 =  Stockholm.ymd(1712,2,30);
    println!("Date: {:?}", feb30);
}
 target/debug/feb30
thread 'main' panicked at /home/snaggen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/chrono-0.4.34/src/offset/mod.rs:252:40:
No such local time
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Result (as expected): Not well! 😄

I also tested Java with

ZonedDateTime feb30 = ZonedDateTime.of(1712,2,30, 0,0,0,0, ZoneId.of("Europe/Stockholm"));

with simmilar result

java.time.DateTimeException: Invalid date 'FEBRUARY 30'

So, lets take a minute of silence for all the programmers of history related software, may the spagetti monster have mercy on their souls.

you are viewing a single comment's thread
view the rest of the comments
[-] jamesthurley@programming.dev 10 points 8 months ago

Off topic, but what terminal font is that? The nerd font icons are a very generous size.

[-] snaggen@programming.dev 10 points 8 months ago

That is wezterm which have builtin Nerd Font fallback, and I actually think WezTerm renders it to wide to fit it better with other fonts. But the rest of the font is JetBrains Mono

this post was submitted on 01 Mar 2024
249 points (99.2% liked)

Programmer Humor

19488 readers
292 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS