31
submitted 10 months ago by yogthos@lemmy.ml to c/programmerhumor@lemmy.ml
you are viewing a single comment's thread
view the rest of the comments
[-] ricecake@sh.itjust.works 2 points 10 months ago

Except it's not nonsense. If you ask for 31 days after January 31st, you don't get February 28th.

A month is a malformed concept to use in conjunction with arithmetic, except for the part where people do it all the time and just ignore the fact that it often gets weird.

Do you really think you'd be happier if the answer for "what's a month from 01/31?” was "InvalidDateException"? That every other month the concept of "a month from today" is just undefined?

Saying "adding a month means adding the number of days in the starting month" is one choice of many, all of which have terrible downsides.

this post was submitted on 06 Nov 2023
31 points (69.1% liked)

Programmer Humor

32060 readers
2643 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS