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

Programmer Humor

19544 readers
589 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
 

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.

top 9 comments
sorted by: hot top controversial new old
[–] steventhedev@lemmy.world 120 points 8 months ago (1 children)

And here I was thinking that adding timezones for mars was going to be the biggest timezone headache in the next 5 years.

[–] souperk@reddthat.com 5 points 8 months ago* (last edited 8 months ago)

Reminds me when dayjs decided to change the duration of a month during a random bugfix. I had to update so many tests...

Now I am going to share a horror story: Multitimezone Operational Calendars

[–] onion@feddit.de 45 points 8 months ago (2 children)
[–] WeirdAlex03@lemmy.zip 26 points 8 months ago

And then you get a call from a Swedish Wikipedia editor and they say:

February 30 was a day that happened in Sweden, 1712.[4] This occurred because, instead of changing from the Julian calendar to the Gregorian calendar by omitting a block of consecutive days, as had been done in other countries, the Swedish Empire planned to change gradually by omitting all leap days from 1700 to 1740, inclusive. Although the leap day was omitted in February 1700, the Great Northern War began later that year, diverting the attention of the Swedes from their calendar so that they did not omit leap days on the next two occasions; 1704 and 1708 remained leap years.[5]

To avoid confusion and further mistakes, the Julian calendar was restored in 1712 by adding an extra leap day, thus giving that year the only known actual use of February 30 in a calendar. That day corresponded to February 29 in the Julian calendar and to March 11 in the Gregorian calendar.[5][6] The Swedish conversion to the Gregorian calendar was finally accomplished in 1753, when February 17 was followed by March 1.[5]

https://en.wikipedia.org/wiki/List_of_non-standard_dates#Swedish_calendar

[–] snaggen@programming.dev 17 points 8 months ago* (last edited 8 months ago)

Yes, that was the first that came to my mind when I saw the TIL post.... which also was why I felt the need to see if that rant is still valid, or if modern libraries could handle that.

[–] ryannathans@aussie.zone 37 points 8 months ago

I think it blows up because you need the Swedish calendar for the date to be valid, our calendar doesn't have this day. The date occurred when Sweden used a different calendar

[–] jamesthurley@programming.dev 10 points 8 months ago (1 children)

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

[–] ridiche@lemm.ee 1 points 7 months ago