News for hackers. Stuff that matters.
Re:Ask HN: Did you encounter any leap year bugs today? by runarberg on Friday March 01, 2024 @01:15AM (#39559054)
I asked JavaScript:

    const { format } = Intl.DateTimeFormat("en-UK", { month: "short", day: "numeric" });

    const date = new Date(2024, 1, 29);
    console.log(format(date));
    // 29 Feb

    date.setYear(2025);
    console.log(format(date));
    // 1 Mar

    const year = 1000 * 60 * 60 * 24 * 365.2425;
    console.log(format(new Date(2024, 1, 29).getTime() + year));
    // 28 Feb
I guess both are logical by some definition of logic.
Re:Ask HN: Did you encounter any leap year bugs today? by paulddraper on Friday March 01, 2024 @06:59PM (#39568346)
I can agree with that.