This looks nice, but UX is horrible. Why don't you just generate a random date and ask the user, if this is correct? Repeat until correct date.
Implement binary search with a set of “I’m older than that” and “I’m younger than that” buttons
I wonder how many times you'd have to press them on average to get the right one.
Base 2 log of the range
Which might be better on average, actually.
You're right, I missed the average.
Average would be
1/n * Sum_(i=1)log n i 2i-1
You're assuming uniform distribution though. Depending on the target users, you'll likely have some normal distribution with the majority of users in a small range of ages. You'll have to account for that.
Unfortunately binary search takes about the same time regardless - unless you happen to be born on one of the days at exactly binary subdivisions. If you biased it towards current ages (eg. started with a date 30 years ago instead of 60 years ago) you'd still only save about 1 click.
man this conversation reminds me of the dick-jerk-algorithm from silicon valley
So 15.4 times to narrow down to single day between 1 and 120 years ago!
Which is definitely faster than some calendar style date pickers I've used.
The ones that start on the current month and only let you go back one month at a time until you get to your birthday. Which for some of us is just enough time to contemplate, during our seemingly interminable clicking, how old we're getting, even if we're not all that old
Pretty sure, you can click on the year in the middle top and select a different year.
On most of them, yes. For whatever reason there are absolutely feature incomplete calendar selectors out there in the wild.
You can't be a senior front-end engineer until you've built at least one calendar picker from scratch because the only libraries that work with your codebase are almost perfect, but don't have that one minor feature you need that no user will ever notice.
This is only true if you use a bounded range and users are uniformly distributed. You can't make both work at the same time since there are some but very few 100 year olds.
Let's assume you know the distribution of your user base, you can then perform a binary search on what percentile the user is in the user base. Each time you cut the space left open in half, so you gain 1bit of Shannon information. So the average number of search steps is the average information needed to specify a value. This is just the definition of the Shannon entropy of your user age distribution.
If you don't know your user base age distribution and use an approximation like the age distribution in your country, you just add the cross entropy of those distributions.
The worst case isn't that bad. If we take January 1st 1900 as the start date, and today (July 14th) as the end, there has been 45,850 days.
I believe the worst case is ceiling(log₂(n))
. In this case, where n is 45,850, you get 16 clicks.
So, a standard date selector is six clicks, plus scrolling. I’ve definitely used a few where the UI was worse than that. So this actually compares better than I would have expected. Still not great, but not as ridiculously bad as I would have estimated
If you get a person to correctly click 16 times when they are 0 days old, that is not the worst case possible.
There's more than 0 days old as the worst case. From a very quick bit of python code, I get 13,083 worst cases, just shy of 30% of all cases.
2 steps: 2
3 steps: 4
4 steps: 8
5 steps: 16
6 steps: 32
7 steps: 64
8 steps: 128
9 steps: 256
10 steps: 512
11 steps: 1024
12 steps: 2048
13 steps: 4096
14 steps: 8192
15 steps: 16384
16 steps: 13083
Going back to the parent question, now I have the python code, looks like bisecting that range has an average step count of 14.571.
edit: Yes, I'm in a fun meeting right now...
Let's say the input options are "Younger" and "Equal or older". One step gives two total options. Two steps give four total options (adding two). Three steps give eight total options (adding four), and so on. You could say that the last step is responsible for half of the options, but you still need to finish asking all of the questions regardless of which option is ultimately being selected. The only exception to this is when the last "layer" is not full, but then we are still only able to skip the last step, so the average number of steps must be in between 15 and 16.
There are two ways we can end the questions early while maintaining precision. The first is by introducing more input options (e.g. "Younger", "Equal", and "Older"), but that extra "power" is better spent on splitting the remaining options in three equally big chunks (instead of "wasting" it on the rarely used "Equal"). The second is by biasing the process so that some options are more easily reached than others (essentially compression), but this is inefficient unless the users have a similar bias in what they want to select, so the average number of steps would be higher.
Sorry, you’re not getting my answer. Nice try, phisher!
Around 16 on a 100-years range
The previous answer you got was wrong. From my comment correcting it. The actual answer is about 1 question lower than a naive estimate - you need ~14.3 questions on average if I use the data for Germany
Let's assume you know the distribution of your user base, you can then perform a binary search on what percentile the user is in the user base. Each time you cut the space left open in half, so you gain 1bit of Shannon information. So the average number of search steps is the average information needed to specify a value. This is just the definition of the Shannon entropy of your user age distribution in bits.
If you don't know your user base age distribution and use an approximation like the age distribution in your country, you just add the cross entropy of those distributions.
I did the entropy estimation for Germany using the age pyramid and assuming equal distribution in each strata (here we save ~0.9 bits compared to 120year time span) and using actual data on birthdays (which saves like ~0.1 bits compared to equal birthday distribution, basically all of that is seasonality of births)
Huh, it's actually not that bad now that I've seen it live.
It's fun but also I'm terrible at date math and keep fucking up whether I'm older or younger lmao
I can figure out older/younger if it's year, but when it's in the months I had to think for a bit trying to figure out which it is.
I feel seen
100%, later and earlier are much quicker mentally for me, changed the buttons to that and it was not much slower than a usual drop down.
I'd find it a lot less confusing if the buttons just said + and -
I think that would actually result in quicker entry than some dialogs I’ve seen.
And that's how BogoUX was born.
Make the year a count with start/stop and clear button but no max. Bonus you allow increments of 3s and decrements of 2s or something heinous for fine tuning 💀
Just generate complete random string of letters and numbers. That way you can cover future scenarios if more numbers or months are added in the future. User can parse until their exact birth date comes up
Point a camera at a wall of lava lamps. When the lava aligns to spell out their birthdate have them take a screen shot and upload it.
Don't forget to include hour, minute, second, millisecond and tick.
...not that it's needed, but it completes the picture.
Also do it for names. A Random name generator. And then you'd have to install special packs for different regions for like a name library. Japanese library will have names like Kenta, Ryo, Shin etc, Or Mexican Library will have Jorge, Rodriguez etc.
This should've been the first comment. Up you go.
funny thing is, they actually stole this post from there
I'm having a stroke reading the months. The phone UI selectors were funny, but I don't think I can survive if they do month selectors.
Just a form with a built-in CAPTCHA.
If the combination is not a valid month, you discard the request.
My thinking as well. I like it
The best thing is that ChatGPT seems to understand it, but then it fucks it up in its typical fashion:
✅ JavaScript Script to Fill the Form:
<script>
// Wait for the DOM to fully load
window.onload = function() {
// Set the day
document.getElementById("day-month").value = "14";
// Select options to form a month (e.g., "February")
document.getElementById("select-id-1").selectedIndex = 4; // "febr"
document.getElementById("select-id-2").selectedIndex = 4; // "a"
document.getElementById("select-id-3").selectedIndex = 3; // "uary"
// Set the year
document.getElementById("year").value = "2025";
// Optional: Submit the form manually
document.querySelector("form").submit();
};
</script>
📌 Notes:
This script assumes you want to select "February" by piecing together febr + a + uary.
probably didn't understand (took me a while too) that you can select an empty value
A Captcha is usually a problem that is fundamentally difficult for a computer to solve, whereas solving this looks like a fun project for an Introduction to Programming course (and the result would probably have a higher accuracy rate than humans).
The only bot I can think of which would be designed to navigate a webpage which it was not specifically designed for is a web crawler, but do those bother with forms?
ah yes,
jay
mmm.. D E C A Y
31st Februlyber 1900
It’s funny because everyone knows there’s only 29 days in the month of Februlyber
um ackshually Februlyber has 32 days in years that are divisible by 0xBEEF
😂
🤣🤣
Finally, something with my birthday of Munepril 0, 1900!
I dropped my biscuit... Good job!
It's Joctober
An excellent example of user-centric design.
Lousy Jarch weather
But you know what they say, Jarch heat means Deculypril can't be beat.
Jarch is Arch Linux, but all tools and packages are written in Java.
"I use Jarch btw"
Man the first thing I looked for was if i could make Smarch lol
i love this so much.
When the database engineer responsible for normalization writes the UI code. NO REDUNDANCY!
You know what? Joctober sounds cool
It's pronounced "G"october
Novoctopril sounds like some medication with a 3 minute commercial naming side effects.
Mmmm my favorite month, moctopril
I think my dad took that for his high blood pressure.
🤣
21 instead of 12 fields, with the possibility of making stupid inputs. This is really genius
You left out Smarch.
Gosh dang. I've been coding for a long time, and this right here is the most cursed thing I've ever seen.
You are not alone 😂😂😂
7th Jay
This is terrible. It's hard to read, has too many strings used by only one month, and doesn't even start all months in the first column. I propose the following instead.
jan y
febr uar rch
ma l pril
a em ne
ju ugust
sept ber
octo
nov
dec
Noo, now I can’t enter my birth month of Joctorch
Thankyou for fixing july
Joctober
Septuney, what a beautiful month to be Born in
good captcha
I've always confuse the 6 and the 7 month, Manuary and Memuary. Not sure why.
Munepril, best month of the year
Lousy Jarch weather...
jemy
Ah yes my favorite month, joctober
Only alphas are born in Manuary.
You leave my boy Joctober alone, he didn't hurt anyone.
It's so Joctober
Ah yes, RimWorld months.
Born in Septanuary
Is "Novemy" a tragedeigh?
Jarch
Jemuary
there’s not even a way to input smarch
Do you remember the 21st night of Jember?
No way to spell July if all cols are required. "Julyy"
Each drop down list has an option of being blank, if you look. Otherwise February, April, June, July, August, and October are impossible (a full half of all months).
I'm hoping the slider works in month increments.
millisecond increments
It's not a man's date picker unless it comes with a seizure warning. Now there's a form with some chest hair!
joctopril
any other Decay babies here?
Okay but "" is a valid month.
I hope this was a Mapril Fool’s Day joke
How Many 0th 1900!
Deserves the Original Solution award of the month.
Jocktober is my favorite month, just after twinkuary
Ah yes, a gambler's widget. Month as a slot machine.
To think the person who made this actually got paid muney.
joctober
I love that secret 0 day of the month only programmers get
Septoctouary?
Munepril my favorite month.
Who went through each month in their head, seeing if it can be built?
If you ask me, all the best life events happen in Septunepril.
Love the month Jay
Ah yes, the best birth month, Joctober.
munepril
This is how AI works under the hood right??
This is how the names of the RimWorld months were created.
They missed there shot here with smarch weather.
Hmmm, I calculate that there are a total of 288 combinations if we figure they can be a combination of columns 1,2,3 or 1,2 or 2,3. I however do not have the heart to sit here and list them all. I am curious though. Anyone wanna take a whack at it? Seems to be a fairly easy program to write and just screenshot the end results or something.
Looks like some database guy normalized the month field.
I hate that uly is in the middle instead of just ul.
Oh god, I can imagine I made that before I found out not everyone has an engineering brain, and we should design for "real people" not me.
bruh.
took me a minute to understand lmao
Could optimize from j-uly-blank -> j-ul-y
Me working on my first website in college 💀
Manugust, me after eating too many beans
make sure the year input is read-only. some roque user might enter 1899 otherwise
hey what month were you born in
JOCTOY
Remember when this sub still had original posts, and we were all trying to come up with the worst ever UI for date selection? That was a great time.
Ive noticed a problem.
J ULY is redundant, as there is already a Y in the final dropdown.
It should be J UL Y
I was born in Deculyugust
please tell me its a slot machine for the month that costs irl money
Great application of the DRY principle. You have to repeat "BER" four times (can you imagine!) if this was not the case. And let's imagine that we decide to change the name of the months, then we would have had to update it in four places. This programmer helps to spread the joy of his cleverness, not just to other programmers reading the code, but to the users as well. This makes the user think "wow, how clever. The guy coming up with this was really smart".
I think my biggest complaint is the validation logic. Some months you'd leave the middle column unselected and others it'd be the left or right column. Just ugly.
It’s Febranugust again! (Edit: typo)
All of those combo boxes take up too much screen space.
Instead, you could simplify the whole UI into a single “numberOfDaysSinceBirth” slider.
You’re welcome.
Joctober
joctober, seems legit
Only real men have birthday as Memuary
What star sign am I if I was born in Jemy?
broke: joever
woke: joctober
Joctorch sounds like a medical condition.
"uly" should be "ul", and then you can use the "y" from the right.
there's a bug on a website
ProgrammerHumor: "lol what? How can you write a bug? I, personally, never write bugs. All my form fields are bugless!"
Month picker that doubles as a passphrase generator.
DRY zealots loved this
uly should be split into ul and y, since y already exists as an option
They could've shortened "uly" by one character. Smh
I was bor in jay
joctober
Febtober!
-Sir Sean Connery
You can't spell february
or I'm too dumb to see it
I like this version of reCAPTCHA
Now make it autoprogress after the user enters any value please
Ah yes, my favourite month; Febroctougust.
Ah, Septuneuary 1900, such a lovely month it was.
Might I add, precisely the 0th of Septuneuary 1900 was the best
Yeah i febrember it quite well
I laughed quite hard at this
How confusing it is for all the Jasons born in Jay.
“Wake me up when Novoctougust ends” is one of my favourite songs.
I was born on Septuneuary 180, 1900.
(assuming that number field allows any number greater than 0 - I bet it's all validated on the backend)
Same year the Brooklyn Bridegrooms, led by Tungsten Arm O'Doyle, beat the Wilmington Quicksteps in 7.
I'm a bigger fan of Memy and Decoctopril personally
Talk to your doctor about whether Decoctopril is right for you
Do not take Decoctopril if you are allergic to it. Side effects include Blindness, Insanity and Cannibalistic thoughts or actions
Don't forget to slip "sudden death" in at the end, said as fast as humanly possible.
Mine is Jay
Jemy is fun.
What about the month of decay?
That's every month
Nurgle will be pleased
I'm a real februlyber
It's Joctorch or Memy for me
An average Germanic word
I’m more of a Jember guy
Mine is Member.
I'm more of a Joctorch guy myself
Febroctopril is my favorite
Lousy Smarch weather.
Febroctougust 255 of 1900 was a hell of a Day, almost went to negatives
Not Joctoy?
i was born is januneugust
My favourite is Jay
The Many month
Say what you want about Febroctougust, but at least it doesnt have that lousy Smarch weather!
🤣
Novulyuary is a good one.