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.

  • WeirdAlex03
    263 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]