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...
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)
Sorry, you’re not getting my answer. Nice try, phisher!
Around 16 on a 100-years range
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 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.
funny thing is, they actually stole this post from there
This should've been the first comment. Up you go.
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
Finally, something with my birthday of Munepril 0, 1900!
I dropped my biscuit... Good job!
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
It's Joctober
No Jork Joctober 😔
The invention of the textbox was the moment when the internet went too far.
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!
Novoctopril sounds like some medication with a 3 minute commercial naming side effects.
21 instead of 12 fields, with the possibility of making stupid inputs. This is really genius
You know what? Joctober sounds cool
It's pronounced "G"october
Mmmm my favorite month, moctopril
I think my dad took that for his high blood pressure.
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
Septuney, what a beautiful month to be Born in
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
I've always confuse the 6 and the 7 month, Manuary and Memuary. Not sure why.
Joctober
good captcha
Lousy Jarch weather...
Munepril, best month of the year
jemy
Only alphas are born in Manuary.
Ah yes my favorite month, joctober
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?
That's what happens when you ask a mathematician to create a datepicker.
"oh there are common factors and patterns, let me optimize it"
Jarch
Okay but "" is a valid month.
Jemuary
To think the person who made this actually got paid muney.
there’s not even a way to input smarch
Love the month Jay
Do you remember the 21st night of Jember?
hey what month were you born in
JOCTOY
This would actually be kinda cool if selecting an option limited the remaining ones to what's possible. Like choosing "A" would leave just "pril" and "ugust".
...aaaaand I just reinvented auto-complete.
I’m a Jauary kinda guy
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 was born in Deculyugust
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
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".
any other Decay babies here?
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.
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.
I was bor in 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
Remember, remember, the 5th of Member
My favorite is Member
Oh damn, is it already almost joctoy again?
I vote for joctoy.
ah yes, my favorite month. jay.
Me working on my first website in college 💀
https://i.imgur.com/teZjwam.png
Diagrammed them out, seems to actually be pretty efficient if you're just trying to minimize the tallest column and reduce number of letters per cell.
Didn't notice M-A-Y until I did that though and now that's my favorite.
Manugust, me after eating too many beans
make sure the year input is read-only. some roque user might enter 1899 otherwise
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
Joctoy... that was my nickname in highschool!
'twas the month of jay, all people were gay for before them lay novoctuaraay
mr krabs' birthday is in muney
Ah yes, Joctougust. The best of months.
Decanaugust
I think I hate this so much that it almost has come full circle to where I love it
Was this trash made by Pirate Software?
Joctorch
Yeah I was born 20th ::squint eyes:: joctopril 1980ish
Is this a captcha?
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.
Jay
I personally enjoy the 1st of Many, any year.
Programmer month index starts at 0
“Wake me up when Novoctougust ends” is one of my favourite songs.
That is a weirdly satisfying word to say.
I think it's the "vock-too-gus" that really makes it for me.
Same year the Brooklyn Bridegrooms, led by Tungsten Arm O'Doyle, beat the Wilmington Quicksteps in 7.
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)
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.
Shout out to Jarch
What about the month of decay?
That's every month
Nurgle will be pleased
It's Joctorch or Memy for me
I'm a real februlyber
Febroctopril is my favorite
Ask your doctor about Febroctopril today. Women who are pregnant or may become pregnant shouldn't take Febroctopril. Other symptoms may include, not limited to: nausea, headaches, new or worsening depression, temporal dislocation, dyslexia, and death.
Mine is Member.
An average Germanic word
I’m more of a Jember guy
Lousy Smarch weather.
I'm more of a Joctorch guy myself
Febroctougust 255 of 1900 was a hell of a Day, almost went to negatives
Not Joctoy?
Is Joctober before or after the Trucktober sales event? I can never remember.
Say what you want about Febroctougust, but at least it doesnt have that lousy Smarch weather!
i was born is januneugust
My favourite is Jay
The month of Many
I also love joctoy
Mine is Jay. Simple and nice
Yall just mad because you’re not joctoy babies