fjärrinlägg från:

TIL: Sweden had February 30 in 1712 , 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);
thread 'main' panicked at /home/snaggen/.cargo/registry/src/
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.

  • @steventhedev
    1163 months ago

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

    • @[email protected]
      3 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