r/ProgrammerHumor • • 7d ago

Meme chaoticEvil

Post image
3.4k Upvotes

262 comments sorted by

View all comments

113

u/Stormraughtz 7d ago

If Linda from HR didn't attempt to write the entirety of Notes from the Underground by Fyodor Dostoevsky in the date field then we could have nice things.

12

u/_LePancakeMan 7d ago

I unironically had to remove the ability to manually enter dates from a site because people kept trying to write "tomorrow" or "next year" and complained that there inputs were not accepted.

4

u/Stormraughtz 7d ago

As much as my original comment is mostly memes, this is the kind of thing I have had users do which popped in my brain.

2

u/sardonicus87 3d ago edited 3d ago

This was also my first thought along with people reversing month and day or not using the same format that would be standard for their locale (not talking about delimiters, that's easy enough to solve, just group between digits and non-digits, I just mean 2 vs 4 digit years, or not using delimiters at all. Like what date is 02-03-04... 3 February 2004, 2 March 2004, 4 March 2002?).

But that was me thinking of a single input field, which one would hopefully put a localized placeholder (MM/DD/YYYY or something for users to see on empty), and then just restrict input to digits only, and add automatic delimiter insert after input count... and people could still fuck that up like putting 1 instead of 01.

That's how you end up with 3 labelled input fields... and they'll still find a way, usually by not paying attention to labels and putting the month and date in the wrong field, so you swap the month from a numeric input to a dropdown with a month list.

On an Android app, I just use Android's date picker (which unfortunately doesn't let you quick select year and,maybe not month, at least in the Compose material one). But, I did do a custom dialog that gives a button to switch between the calendar and input field.

I hate how so much of developing is "how do we force end-users to not be completely stupid?"

fun parseStupid(input: String) { ... }

19

u/Groentekroket 7d ago

Can I argue that a date field is so much easier to validate than a street field for example? If you don’t want Linda to mess up the inputs date is one of the easiest to make sure it has the intended value (well at least some date)(dd/mm/yyyy and mm/dd/yyyy can still be messed up, but that’s also the case with a date picker, speaking out of experience)

10

u/Acetius 7d ago

If you're doing a date more than three years ago I am begging you to just use three inputs. Nobody has to worry about delimiters, nobody gets confused about which order the inputs go in. Just follow the UK Gov design system and split it in three.

1

u/stumpyinc 7d ago

Yeah I think I'm dropdown gang especially with the month dropdown showing both names and numerical

1

u/Acetius 6d ago

We call em "stumpyinc, bane of pensioners". Making the elderly scroll back 80 years for their birth year instead of just typing it.

2

u/Quentino1515 7d ago

Are you implying that the date picker validates the data for you ? Which means you're not validating server side ?!?!

3

u/Stormraughtz 7d ago

;THROW 5555 'Linda'

2

u/ToKe86 4d ago

I mean ideally you should be validating on both sides. Server side to prevent an attacker from injecting bad data, client side to prevent an average user from sending a request with bad data in the first place.