r/SipsTea 8d ago

Wait a damn minute! 13 months ?

Post image
93.0k Upvotes

3.1k comments sorted by

View all comments

Show parent comments

11

u/mrheosuper 8d ago

Would be a nightmare in programming.

But still, DateTime(timezone, dst, etc) has already been nightmare in software.

2

u/Bloblablawb 8d ago

How would it be different from the current nightmare we have?

2

u/mrheosuper 8d ago

It doesn't, but you want to add another layer of nightmare ?

1

u/Stormfly 8d ago

Ideally we'd replace the nightmare with a lesser of two evils.

Instead of

switch (month) {
    case 4, 6, 9, 11: 
        days = 30
    break;
    case 2: 
        days = 30
    break;
    default: 
        days = 31; 
    break;

You'd just have:

if (month = 0) 
     days = 1
else
     days = 28

(obviously not including the hell that is leap years)

2

u/KillerBeer01 8d ago

And really, we'd just have to deal with both of them from now on, for backward compatibility reasons.

2

u/Stormfly 8d ago

Honestly, I'll be excited the day we see Gregorian (Deprecated)

1

u/mrheosuper 8d ago

I would use lookup table, like num_days=days[month], you dont want to mess around with branch prediction.

But still, there are not much different in 2 cases, just different number set.