this post was submitted on 06 Nov 2023
30 points (68.3% liked)

Programmer Humor

32171 readers
1069 users here now

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

Rules:

founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] ricecake@sh.itjust.works 2 points 11 months ago (1 children)

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.